Skip to content

Commit

Permalink
Merge pull request #37676 from kubabutkiewicz/ts-migration/G9
Browse files Browse the repository at this point in the history
[No QA] [TS migration] Migrate 'GooglePlacesUtils.perf-test.js' , 'merge.js' , 'adbTypeText.js' , adbBackspace.js' ,  'removeInvisibleCharacters.js' test to TypeScript
  • Loading branch information
flodnv authored Mar 13, 2024
2 parents fa6bcc0 + d3ddd48 commit 62035d0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import execAsync from '../utils/execAsync';
import * as Logger from '../utils/logger';

const adbBackspace = async () => {
const adbBackspace = () => {
Logger.log(`🔙 Pressing backspace`);
execAsync(`adb shell input keyevent KEYCODE_DEL`);
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import execAsync from '../utils/execAsync';
import * as Logger from '../utils/logger';

const adbTypeText = async (text) => {
const adbTypeText = (text: string) => {
Logger.log(`📝 Typing text: ${text}`);
execAsync(`adb shell input text "${text}"`);
return true;
Expand Down
19 changes: 9 additions & 10 deletions tests/e2e/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ const createServerInstance = (): ServerInstance => {

case Routes.testNativeCommand: {
getPostJSONRequestData<NativeCommand>(req, res)
?.then((data) =>
nativeCommands.executeFromPayload(data?.actionName, data?.payload).then((status) => {
if (status) {
res.end('ok');
return;
}
res.statusCode = 500;
res.end('Error executing command');
}),
)
?.then((data) => {
const status = nativeCommands.executeFromPayload(data?.actionName, data?.payload);
if (status) {
res.end('ok');
return;
}
res.statusCode = 500;
res.end('Error executing command');
})
.catch((error) => {
Logger.error('Error executing command', error);
res.statusCode = 500;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {measureFunction} from 'reassure';
import * as GooglePlacesUtils from '../../src/libs/GooglePlacesUtils';
import * as GooglePlacesUtils from '@src/libs/GooglePlacesUtils';

const addressComponents = [
const addressComponents: GooglePlacesUtils.AddressComponent[] = [
{
long_name: 'Bushwick',
short_name: 'Bushwick',
Expand Down Expand Up @@ -34,7 +35,7 @@ const addressComponents = [
},
];

const bigObjectToFind = {
const bigObjectToFind: GooglePlacesUtils.FieldsToExtract = {
sublocality: 'long_name',
administrative_area_level_1: 'short_name',
postal_code: 'long_name',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'underscore';
import enEmojis from '../../assets/emojis/en';
import StringUtils from '../../src/libs/StringUtils';
import enEmojis from '@assets/emojis/en';
import StringUtils from '@src/libs/StringUtils';

describe('libs/StringUtils.removeInvisibleCharacters', () => {
it('basic tests', () => {
Expand Down Expand Up @@ -80,7 +79,7 @@ describe('libs/StringUtils.removeInvisibleCharacters', () => {
expect(StringUtils.removeInvisibleCharacters('test😀😀😀')).toBe('test😀😀😀');
});
it('all emojis not removed', () => {
_.keys(enEmojis).forEach((key) => {
Object.keys(enEmojis).forEach((key) => {
expect(StringUtils.removeInvisibleCharacters(key)).toBe(key);
});
});
Expand Down

0 comments on commit 62035d0

Please sign in to comment.