Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions test/unit/remote-config/remote-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,48 @@ describe('RemoteConfig', () => {
expect(p1.description).equals('this is a promo');
expect(p1.valueType).equals('BOOLEAN');

const p2 = newTemplate.parameters['new_ui_enabled'];
expect(p2.defaultValue).deep.equals({ value: 'false' });
expect(p2.conditionalValues).deep.equals({
ios: {
rolloutValue: {
rolloutId: 'rollout_1',
value: 'true',
percent: 50,
}
}
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the newly defined interfaces to perform the assertions instead of deep checks. For example, in this case, extract the conditional values into a variable of type RolloutParameterValue and assert on individual fields.

Do the same for subsequent assertions as well for types like PersonalizationParameterValue and ExperimentParameterValue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the assertions to use the explicit RolloutParameterValue, PersonalizationParameterValue, and ExperimentParameterValue interfaces, and asserted on individual fields as requested.

expect(p2.description).equals('New UI Rollout');
expect(p2.valueType).equals('BOOLEAN');

const p3 = newTemplate.parameters['personalized_welcome_message'];
expect(p3.defaultValue).deep.equals({ value: 'Welcome!' });
expect(p3.conditionalValues).deep.equals({
ios: {
personalizationValue: {
personalizationId: 'personalization_1',
}
}
});
expect(p3.description).equals('Personalized Welcome Message');
expect(p3.valueType).equals('STRING');

const p4 = newTemplate.parameters['experiment_enabled'];
expect(p4.defaultValue).deep.equals({ value: 'false' });
expect(p4.conditionalValues).deep.equals({
ios: {
experimentValue: {
experimentId: 'experiment_1',
variantValue: [
{ variantId: 'variant_A', value: 'true' },
{ variantId: 'variant_B', noChange: true }
]
}
}
});
expect(p4.description).equals('Experiment Enabled');
expect(p4.valueType).equals('BOOLEAN');

expect(newTemplate.parameterGroups).deep.equals(PARAMETER_GROUPS);

const c = newTemplate.conditions.find((c) => c.name === 'ios');
Expand Down