fix(gateway): split profile identity from scenario

This commit is contained in:
2026-08-13 16:03:41 +00:00
parent 826d17da81
commit 6478a9f478
26 changed files with 399 additions and 83 deletions
+10 -10
View File
@@ -6,25 +6,25 @@ describe('orderGatewayProfiles', () => {
it('uses the public server order instead of alphabetical profile order', () => {
const profiles = ['hwe', 'pya', 'che', 'nya', 'twe', 'pwe', 'kwe'].map((profile) => ({
profile,
scenario: 'default',
instanceKey: 'default',
}));
expect(orderGatewayProfiles(profiles).map(({ profile }) => profile)).toEqual(GATEWAY_PROFILE_ORDER);
});
it('orders scenarios within a profile and places unknown profiles afterward', () => {
it('orders instance keys within a profile and places unknown profiles afterward', () => {
const profiles = [
{ profile: 'zeta', scenario: 'default' },
{ profile: 'che', scenario: '20' },
{ profile: 'alpha', scenario: 'default' },
{ profile: 'che', scenario: '10' },
{ profile: 'zeta', instanceKey: 'default' },
{ profile: 'che', instanceKey: '20' },
{ profile: 'alpha', instanceKey: 'default' },
{ profile: 'che', instanceKey: '10' },
];
expect(orderGatewayProfiles(profiles)).toEqual([
{ profile: 'che', scenario: '10' },
{ profile: 'che', scenario: '20' },
{ profile: 'alpha', scenario: 'default' },
{ profile: 'zeta', scenario: 'default' },
{ profile: 'che', instanceKey: '10' },
{ profile: 'che', instanceKey: '20' },
{ profile: 'alpha', instanceKey: 'default' },
{ profile: 'zeta', instanceKey: 'default' },
]);
expect(profiles[0]?.profile).toBe('zeta');
});