Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghx committed Aug 11, 2022
1 parent f50e741 commit 2741e94
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ describe('test/app.test.ts', () => {
await app.load(manifest.default, appDir);

app.run();
expect((app as any).state === ArtusApplicationState.STARTING);
expect((app as any).state).toBe(ArtusApplicationState.STARTING);
await new Promise(resolve => setTimeout(resolve, 1000));
expect((app as any).state === ArtusApplicationState.STARTED);
expect((app as any).state).toBe(ArtusApplicationState.STARTED);

app.close();
expect((app as any).state === ArtusApplicationState.CLOSING);
expect((app as any).state).toBe(ArtusApplicationState.CLOSING);
await new Promise(resolve => setTimeout(resolve, 1000));
expect((app as any).state === ArtusApplicationState.CLOSED);
expect((app as any).state).toBe(ArtusApplicationState.CLOSED);
});

it('should state set to error', async () => {
Expand All @@ -83,18 +83,18 @@ describe('test/app.test.ts', () => {

// test run
await app.run().catch(() => null);
expect((app as any).state === ArtusApplicationState.START_ERROR);
expect((app as any).state).toBe(ArtusApplicationState.START_ERROR);
mm.restore();
await app.run();
expect((app as any).state === ArtusApplicationState.STARTED);
expect((app as any).state).toBe(ArtusApplicationState.STARTED);

// test close
mm(LifecycleManager.prototype, 'emitHook', () => Promise.reject('err'));
await app.close().catch(() => null);
expect((app as any).state === ArtusApplicationState.CLOSE_ERROR);
expect((app as any).state).toBe(ArtusApplicationState.CLOSE_ERROR);
mm.restore();
await app.close();
expect((app as any).state === ArtusApplicationState.CLOSED);
expect((app as any).state).toBe(ArtusApplicationState.CLOSED);
});
});
});

0 comments on commit 2741e94

Please sign in to comment.