29 lines
968 B
TypeScript
29 lines
968 B
TypeScript
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);
|
|
});
|