@@ -0,0 +1,33 @@
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import { freshPlayer, loadArtifact, withReadRetry } from './_setup/harness.js';
|
||||
import type { SeedArtifact } from './_setup/types.js';
|
||||
|
||||
interface GameRemoteConfig extends Record<string, unknown> {
|
||||
max_energy: number;
|
||||
spawn_rate: number;
|
||||
feature_x: boolean;
|
||||
welcome_text: string;
|
||||
shop_layout: Record<string, unknown>;
|
||||
}
|
||||
|
||||
describe('e2e-prod: remoteConfig', () => {
|
||||
let artifact: SeedArtifact;
|
||||
beforeAll(() => {
|
||||
artifact = loadArtifact();
|
||||
});
|
||||
|
||||
it('loads typed configs matching the seeded values', async () => {
|
||||
const rc = artifact.remoteConfigs;
|
||||
const client = await withReadRetry(
|
||||
() => freshPlayer<GameRemoteConfig>(artifact),
|
||||
(candidate) => candidate.remoteConfig.get('max_energy', 0) === rc.maxEnergy,
|
||||
);
|
||||
expect(client.remoteConfig.status).toBe('ready');
|
||||
|
||||
expect(client.remoteConfig.get('max_energy', 0)).toBe(rc.maxEnergy);
|
||||
expect(client.remoteConfig.get('spawn_rate', 0)).toBeCloseTo(rc.spawnRate);
|
||||
expect(client.remoteConfig.get('feature_x', false)).toBe(rc.featureX);
|
||||
expect(client.remoteConfig.get('welcome_text', '')).toBe(rc.welcomeText);
|
||||
expect(client.remoteConfig.get('shop_layout', {} as Record<string, unknown>)).toEqual(rc.shopLayout);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user