Skip to content

Commit b331234

Browse files
authored
Merge pull request #120 from MongooseMoo/fix/master-ci-microtask-tests
Fix lifecycle tests after batched store merge
2 parents 0ce34ae + 608f109 commit b331234

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/client.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,14 @@ describe('MudClient lifecycle cleanup', () => {
403403
expect(socket.send).toHaveBeenCalledWith('look\r\n');
404404
});
405405

406-
it('reports a disconnected command without adding local echo', () => {
406+
it('reports a disconnected command without adding local echo', async () => {
407407
mockPreferencesState.general.localEcho = true;
408408
const client = new MudClient('example.test', 443);
409409

410410
expect(() => client.sendCommand('look')).not.toThrow();
411411

412+
// outputStore batches appends into a microtask flush; let it run.
413+
await Promise.resolve();
412414
expect(useOutputStore.getState().entries).toEqual([
413415
{
414416
id: 1,

src/createConfiguredClient.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ describe("createConfiguredClient", () => {
224224
expect(useUserlistStore.getState().hasReceivedList).toBe(true);
225225
});
226226

227-
it("resets session-owned feature state while preserving user history and input", () => {
227+
it("resets session-owned feature state while preserving user history and input", async () => {
228228
client = createConfiguredClient();
229229
const closeListeners: Array<() => void> = [];
230230
const stream = {
@@ -297,6 +297,8 @@ describe("createConfiguredClient", () => {
297297
useOutputStore.getState().addMessage("connection history");
298298

299299
client.close();
300+
// History stores batch appends into a microtask flush; let them run.
301+
await Promise.resolve();
300302

301303
expect(useCharacterStatusStore.getState().vitals).toBeNull();
302304
expect(useItemsStore.getState().itemsByLocation).toEqual({});

0 commit comments

Comments
 (0)