chore: update api / test
This commit is contained in:
@@ -55,11 +55,11 @@ describe('GameHost', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('onInput', () => {
|
||||
describe('tryInput', () => {
|
||||
it('should return "No active prompt" when no prompt is active', () => {
|
||||
const { host } = createTestHost();
|
||||
|
||||
const result = host.onInput('play X 1 1');
|
||||
const result = host.tryInput('play X 1 1');
|
||||
expect(result).toBe('No active prompt');
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('GameHost', () => {
|
||||
expect(promptEvent.schema.name).toBe('play');
|
||||
expect(host.activePromptSchema.value?.name).toBe('play');
|
||||
|
||||
const error = host.onInput('play X 1 1');
|
||||
const error = host.tryInput('play X 1 1');
|
||||
expect(error).toBeNull();
|
||||
|
||||
// Cancel to end the game since start runs until game over
|
||||
@@ -97,7 +97,7 @@ describe('GameHost', () => {
|
||||
|
||||
const promptEvent = await promptPromise;
|
||||
|
||||
const error = host.onInput('invalid command');
|
||||
const error = host.tryInput('invalid command');
|
||||
expect(error).not.toBeNull();
|
||||
|
||||
promptEvent.cancel('test cleanup');
|
||||
@@ -113,7 +113,7 @@ describe('GameHost', () => {
|
||||
const { host } = createTestHost();
|
||||
host.dispose();
|
||||
|
||||
const result = host.onInput('play X 1 1');
|
||||
const result = host.tryInput('play X 1 1');
|
||||
expect(result).toBe('GameHost is disposed');
|
||||
});
|
||||
});
|
||||
@@ -423,7 +423,7 @@ describe('GameHost', () => {
|
||||
expect(promptEvent.schema.name).toBe('play');
|
||||
|
||||
// Submit the move
|
||||
const error = host.onInput(moves[i]);
|
||||
const error = host.tryInput(moves[i]);
|
||||
expect(error).toBeNull();
|
||||
|
||||
// Wait for the command to complete before submitting next move
|
||||
|
||||
Reference in New Issue
Block a user