Skip to content

Commit

Permalink
Revert seed_tools changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m committed Nov 6, 2024
1 parent b70d293 commit 13ce725
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
10 changes: 5 additions & 5 deletions src/seed_tools/utils/seed_validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
Expand Down
6 changes: 3 additions & 3 deletions src/seed_tools/utils/study_json_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('stringifyStudies', () => {
name: 'study',
filter: {
channel: ['CANARY', 'BETA', 'STABLE'],
platform: ['LINUX', 'MAC'],
platform: ['PLATFORM_LINUX', 'PLATFORM_MAC'],
},
},
{ ignoreUnknownFields: false },
Expand Down Expand Up @@ -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 },
Expand All @@ -127,7 +127,7 @@ describe('stringifyStudies', () => {
filter: {
start_date: startDate.toISOString(),
channel: ['CANARY', 'BETA', 'STABLE'],
platform: ['LINUX', 'MAC'],
platform: ['PLATFORM_LINUX', 'PLATFORM_MAC'],
},
},
]);
Expand Down
53 changes: 27 additions & 26 deletions src/seed_tools/utils/study_validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('getStudyErrors', () => {
},
],
filter: {
platform: ['LINUX'],
platform: ['PLATFORM_LINUX'],
channel: ['BETA'],
},
});
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('getStudyErrors', () => {
},
],
filter: {
platform: ['LINUX'],
platform: ['PLATFORM_LINUX'],
channel: ['BETA'],
},
});
Expand All @@ -286,7 +286,7 @@ describe('getStudyErrors', () => {
},
],
filter: {
platform: ['LINUX'],
platform: ['PLATFORM_LINUX'],
channel: ['BETA'],
},
});
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('getStudyErrors', () => {
},
],
filter: {
platform: ['LINUX'],
platform: ['PLATFORM_LINUX'],
channel: ['BETA'],
},
};
Expand Down Expand Up @@ -543,7 +543,7 @@ describe('getStudyErrors', () => {
},
],
filter: {
platform: ['LINUX'],
platform: ['PLATFORM_LINUX'],
channel: ['BETA'],
locale: [],
exclude_locale: ['en'],
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -693,7 +693,7 @@ describe('getStudyErrors', () => {
probability_weight: 100,
},
],
filter: { ...filter, platform: ['LINUX'] },
filter: { ...filter, platform: ['PLATFORM_LINUX'] },
});

expect(
Expand All @@ -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/));
});
});

0 comments on commit 13ce725

Please sign in to comment.