chore: remove effects leftovers, dead SyncedState.set, add modules/resources skill refs
This commit is contained in:
@@ -71,7 +71,6 @@ describe('public API surface', () => {
|
||||
expect(client.modules).toBeDefined();
|
||||
expect(typeof client.modules.call).toBe('function');
|
||||
expect(typeof client.resources).toBe('function');
|
||||
expect(client.effects).toBeDefined();
|
||||
|
||||
expect('battlePass' in client).toBe(false);
|
||||
expect('quests' in client).toBe(false);
|
||||
@@ -80,10 +79,6 @@ describe('public API surface', () => {
|
||||
expect('inventory' in client).toBe(false);
|
||||
expect('remoteConfig' in client).toBe(false);
|
||||
expect('scenarios' in client).toBe(false);
|
||||
expect('onBattlePass' in client.effects).toBe(false);
|
||||
expect('onStoreOffer' in client.effects).toBe(false);
|
||||
expect('onQuest' in client.effects).toBe(false);
|
||||
expect('onLeaderboard' in client.effects).toBe(false);
|
||||
expect('onConfigChanged' in client.effects).toBe(false);
|
||||
expect('effects' in client).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Test-side helpers: load the seed artifact, build SDK clients against prod, and
|
||||
// reach the admin API for wallet grants / player inspection.
|
||||
// Test-side helpers: load the seed artifact and build SDK clients against prod.
|
||||
|
||||
import { RudderClient } from '../../../src/client/RudderClient.js';
|
||||
import type { TokenStore } from '../../../src/token/TokenStore.js';
|
||||
import { createAdminClient, type AdminClient } from './adminClient.js';
|
||||
import { readArtifact } from './artifact.js';
|
||||
import type { SeedArtifact } from './types.js';
|
||||
|
||||
@@ -58,42 +56,3 @@ export async function freshPlayer(
|
||||
await client.auth.loginWithDevice({ region: 'en', language: 'en' });
|
||||
return client;
|
||||
}
|
||||
|
||||
/** Admin (operator) API client authenticated with the seeded operator token. */
|
||||
export function adminApi(artifact: SeedArtifact = loadArtifact()): AdminClient {
|
||||
const api = createAdminClient(artifact.baseUrl);
|
||||
api.setToken(artifact.adminToken);
|
||||
return api;
|
||||
}
|
||||
|
||||
/** Credits a player's wallet through the admin batch endpoint. */
|
||||
export async function grantCurrency(
|
||||
artifact: SeedArtifact,
|
||||
playerId: string,
|
||||
currencyCode: string,
|
||||
amount: number,
|
||||
): Promise<void> {
|
||||
await adminApi(artifact).post(
|
||||
`/platform/v1/projects/${artifact.projectId}/players/wallet/adjust?environment=${artifact.environment}`,
|
||||
{ items: [{ playerId, currencyCode, amount, reason: 'e2e grant' }] },
|
||||
);
|
||||
}
|
||||
|
||||
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
/** Retries a read until ok(result) holds — absorbs release/cache reload lag. */
|
||||
export async function withReadRetry<T>(
|
||||
fn: () => Promise<T>,
|
||||
ok: (value: T) => boolean,
|
||||
tries = 8,
|
||||
gapMs = 1500,
|
||||
): Promise<T> {
|
||||
let last = await fn();
|
||||
if (ok(last)) return last;
|
||||
for (let i = 1; i < tries; i++) {
|
||||
await sleep(gapMs);
|
||||
last = await fn();
|
||||
if (ok(last)) return last;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user