Wrap test in waitForExpect
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -73,7 +73,8 @@
|
||||
"@types/yup": "^0.29.8",
|
||||
"msw": "^0.21.2",
|
||||
"sqlite3": "^5.0.0",
|
||||
"supertest": "^6.1.3"
|
||||
"supertest": "^6.1.3",
|
||||
"wait-for-expect": "^3.0.2"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -20,6 +20,7 @@ import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase'
|
||||
import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine';
|
||||
import { Stitcher } from './Stitcher';
|
||||
import { CatalogProcessingOrchestrator } from './types';
|
||||
import waitForExpect from 'wait-for-expect';
|
||||
|
||||
describe('DefaultCatalogProcessingEngine', () => {
|
||||
const db = ({
|
||||
@@ -83,13 +84,17 @@ describe('DefaultCatalogProcessingEngine', () => {
|
||||
});
|
||||
|
||||
await engine.start();
|
||||
await new Promise<void>(resolve => setTimeout(resolve, 1));
|
||||
expect(orchestrator.process).toBeCalledTimes(1);
|
||||
expect(orchestrator.process).toBeCalledWith({
|
||||
entity: { apiVersion: '1', kind: 'Location', metadata: { name: 'test' } },
|
||||
state: expect.anything(),
|
||||
await waitForExpect(() => {
|
||||
expect(orchestrator.process).toBeCalledTimes(1);
|
||||
expect(orchestrator.process).toBeCalledWith({
|
||||
entity: {
|
||||
apiVersion: '1',
|
||||
kind: 'Location',
|
||||
metadata: { name: 'test' },
|
||||
},
|
||||
state: expect.anything(),
|
||||
});
|
||||
});
|
||||
|
||||
await engine.stop();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user