feat(sdk): define single-game public contracts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import type {
|
||||
GameEntry, GameHost, GameModule, GameServerMessage,
|
||||
PlatformGameSnapshot, PlatformToGameEvent,
|
||||
} from '../../YouleNexus/assets/framework/sdk/contracts/index.ts';
|
||||
|
||||
test('single GameEntry contract has no registry or runtime version member', () => {
|
||||
const module: GameModule = {
|
||||
attach(_host: GameHost) {},
|
||||
handlePlatformEvent(_event: PlatformToGameEvent) {},
|
||||
handleGameMessage(_message: GameServerMessage) {},
|
||||
restore(_deskinfo: unknown) {},
|
||||
dispose() {},
|
||||
};
|
||||
const entry: GameEntry = {
|
||||
key: 'fixture', gameId: 41, route: 'fixture-route',
|
||||
resolveSeatCount: () => 4,
|
||||
createModule: () => module,
|
||||
};
|
||||
assert.equal(entry.route, 'fixture-route');
|
||||
assert.equal('apiVersion' in entry, false);
|
||||
});
|
||||
|
||||
test('public snapshot is plain readonly data', () => {
|
||||
const value = {} as PlatformGameSnapshot;
|
||||
assert.equal('state' in value, false);
|
||||
});
|
||||
Reference in New Issue
Block a user