From 8fc529a1712ff73b65fa637c77e9d7bdede36c0d Mon Sep 17 00:00:00 2001 From: Pedro Guerreiro Date: Thu, 28 Mar 2024 19:05:02 +0000 Subject: [PATCH] fix(typescript): jest tests and types --- src/libs/OptionsListUtils.ts | 2 +- tests/e2e/compare/output/console.ts | 4 ++-- tests/unit/OptionsListUtilsTest.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index ab057a4c10e..bf7ebf42f1a 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -2095,4 +2095,4 @@ export { getTaxRatesSection, }; -export type {MemberForList, CategorySection, CategoryTreeSection, GetOptions, PayeePersonalDetails, Category, Tag}; +export type {MemberForList, CategorySection, CategoryTreeSection, GetOptions, PayeePersonalDetails, Category}; diff --git a/tests/e2e/compare/output/console.ts b/tests/e2e/compare/output/console.ts index 3da0100b603..77170e43f4a 100644 --- a/tests/e2e/compare/output/console.ts +++ b/tests/e2e/compare/output/console.ts @@ -13,8 +13,8 @@ type Entry = { type Data = { significance: Entry[]; meaningless: Entry[]; - errors: string[]; - warnings: string[]; + errors?: string[]; + warnings?: string[]; }; const printRegularLine = (entry: Entry) => { diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index afa9b00ebc6..72f40ea5d98 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; +import type {SelectedTagOption} from '@components/TagPicker'; import CONST from '@src/CONST'; -import type {Tag} from '@src/libs/OptionsListUtils'; import * as OptionsListUtils from '@src/libs/OptionsListUtils'; import * as ReportUtils from '@src/libs/ReportUtils'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -1205,7 +1205,7 @@ describe('OptionsListUtils', () => { name: 'Medical', }, ]; - const smallTagsList: Record = { + const smallTagsList: Record = { Engineering: { enabled: false, name: 'Engineering', @@ -1282,7 +1282,7 @@ describe('OptionsListUtils', () => { data: [], }, ]; - const largeTagsList: Record = { + const largeTagsList: Record = { Engineering: { enabled: false, name: 'Engineering', @@ -2190,7 +2190,7 @@ describe('OptionsListUtils', () => { }); it('sortTags', () => { - const createTagObjects = (names) => _.map(names, (name) => ({name, enabled: true})); + const createTagObjects = (names: string[]) => names.map((name) => ({name, enabled: true})); const unorderedTagNames = ['10bc', 'b', '0a', '1', '中国', 'b10', '!', '2', '0', '@', 'a1', 'a', '3', 'b1', '日本', '$', '20', '20a', '#', 'a20', 'c', '10']; const expectedOrderNames = ['!', '#', '$', '0', '0a', '1', '10', '10bc', '2', '20', '20a', '3', '@', 'a', 'a1', 'a20', 'b', 'b1', 'b10', 'c', '中国', '日本'];