diff --git a/src/seed_tools/utils/seed_validation.test.ts b/src/seed_tools/utils/seed_validation.test.ts index ff215233..3a4ef2fb 100644 --- a/src/seed_tools/utils/seed_validation.test.ts +++ b/src/seed_tools/utils/seed_validation.test.ts @@ -31,7 +31,7 @@ describe('getSeedErrors', () => { } else { study.filter = {}; } - study.filter.platform = study.filter.platform ?? ['LINUX']; + study.filter.platform = study.filter.platform ?? ['PLATFORM_LINUX']; study.filter.channel = study.filter.channel ?? ['BETA']; return Study.fromJson(study, { ignoreUnknownFields: false, @@ -184,19 +184,19 @@ describe('getSeedErrors', () => { // platform tests { filter1: { - platform: ['WINDOWS', 'MAC'], + platform: ['PLATFORM_WINDOWS', 'PLATFORM_MAC'], }, filter2: { - platform: ['MAC'], + platform: ['PLATFORM_MAC'], }, expectedOverlapped: true, }, { filter1: { - platform: ['WINDOWS'], + platform: ['PLATFORM_WINDOWS'], }, filter2: { - platform: ['MAC'], + platform: ['PLATFORM_MAC'], }, expectedOverlapped: false, }, diff --git a/src/seed_tools/utils/study_json_utils.test.ts b/src/seed_tools/utils/study_json_utils.test.ts index b645bce1..9c29d313 100644 --- a/src/seed_tools/utils/study_json_utils.test.ts +++ b/src/seed_tools/utils/study_json_utils.test.ts @@ -44,7 +44,7 @@ describe('stringifyStudies', () => { name: 'study', filter: { channel: ['CANARY', 'BETA', 'STABLE'], - platform: ['LINUX', 'MAC'], + platform: ['PLATFORM_LINUX', 'PLATFORM_MAC'], }, }, { ignoreUnknownFields: false }, @@ -112,7 +112,7 @@ describe('stringifyStudies', () => { filter: { start_date: Math.floor(startDate.getTime() / 1000), channel: ['CANARY', 'BETA', 'STABLE'], - platform: ['LINUX', 'MAC'], + platform: ['PLATFORM_LINUX', 'PLATFORM_MAC'], }, }, { ignoreUnknownFields: false }, @@ -127,7 +127,7 @@ describe('stringifyStudies', () => { filter: { start_date: startDate.toISOString(), channel: ['CANARY', 'BETA', 'STABLE'], - platform: ['LINUX', 'MAC'], + platform: ['PLATFORM_LINUX', 'PLATFORM_MAC'], }, }, ]); diff --git a/src/seed_tools/utils/study_validation.test.ts b/src/seed_tools/utils/study_validation.test.ts index c6f40099..4805f295 100644 --- a/src/seed_tools/utils/study_validation.test.ts +++ b/src/seed_tools/utils/study_validation.test.ts @@ -30,7 +30,7 @@ describe('getStudyErrors', () => { filter: { locale: ['en'], channel: ['CANARY'], - platform: ['WINDOWS'], + platform: ['PLATFORM_WINDOWS'], start_date: Math.floor(new Date('2022-01-01').getTime() / 1000), end_date: Math.floor(new Date('2022-02-01').getTime() / 1000), min_version: '1.0', @@ -141,7 +141,7 @@ describe('getStudyErrors', () => { }, ], filter: { - platform: ['LINUX'], + platform: ['PLATFORM_LINUX'], channel: ['BETA'], }, }); @@ -263,7 +263,7 @@ describe('getStudyErrors', () => { }, ], filter: { - platform: ['LINUX'], + platform: ['PLATFORM_LINUX'], channel: ['BETA'], }, }); @@ -286,7 +286,7 @@ describe('getStudyErrors', () => { }, ], filter: { - platform: ['LINUX'], + platform: ['PLATFORM_LINUX'], channel: ['BETA'], }, }); @@ -362,7 +362,7 @@ describe('getStudyErrors', () => { }, ], filter: { - platform: ['LINUX'], + platform: ['PLATFORM_LINUX'], channel: ['BETA'], }, }; @@ -543,7 +543,7 @@ describe('getStudyErrors', () => { }, ], filter: { - platform: ['LINUX'], + platform: ['PLATFORM_LINUX'], channel: ['BETA'], locale: [], exclude_locale: ['en'], @@ -634,7 +634,7 @@ describe('getStudyErrors', () => { probability_weight: 100, }, ], - filter: { ...filter, platform: ['LINUX'], channel: ['BETA'] }, + filter: { ...filter, platform: ['PLATFORM_LINUX'], channel: ['BETA'] }, }); expect(study_validation.getStudyErrors(study, studyFileBaseName)).toEqual( @@ -693,7 +693,7 @@ describe('getStudyErrors', () => { probability_weight: 100, }, ], - filter: { ...filter, platform: ['LINUX'] }, + filter: { ...filter, platform: ['PLATFORM_LINUX'] }, }); expect( @@ -702,23 +702,24 @@ describe('getStudyErrors', () => { }, ); - test.each([{}, { platform: [] }, { platform: ['LINUX', 'LINUX'] }])( - 'should error if platform is invalid', - (filter: any) => { - const study = Study.fromJson({ - name: 'study', - experiment: [ - { - name: 'experiment1', - probability_weight: 100, - }, - ], - filter: { ...filter, channel: ['BETA'] }, - }); + test.each([ + {}, + { platform: [] }, + { platform: ['PLATFORM_LINUX', 'PLATFORM_LINUX'] }, + ])('should error if platform is invalid', (filter: any) => { + const study = Study.fromJson({ + name: 'study', + experiment: [ + { + name: 'experiment1', + probability_weight: 100, + }, + ], + filter: { ...filter, channel: ['BETA'] }, + }); - expect( - study_validation.getStudyErrors(study, studyFileBaseName), - ).toContainEqual(expect.stringMatching(/(P|p)latform/)); - }, - ); + expect( + study_validation.getStudyErrors(study, studyFileBaseName), + ).toContainEqual(expect.stringMatching(/(P|p)latform/)); + }); });