Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] [TS migration] Migrate 'GooglePlacesUtils.perf-test.js' , 'merge.js' , 'adbTypeText.js' , adbBackspace.js' , 'removeInvisibleCharacters.js' test to TypeScript #37676

Merged
merged 12 commits into from
Mar 13, 2024
Merged
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
Loading