catalog-backend: tweak db tests to work with postgres

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-09-24 16:36:03 +02:00
parent ac7751056a
commit 2a7b9df2ec
@@ -395,15 +395,24 @@ describe('Default Processing Database', () => {
expect(mockLogger.warn).not.toHaveBeenCalled();
}
const [, unprocessed] = await knexTx<DbRefreshStateRow>(
const states = await knexTx<DbRefreshStateRow>(
'refresh_state',
).select();
expect(unprocessed).toEqual(
expect.objectContaining({
entity_ref: 'component:default/1',
location_key: step.expectedLocationKey,
}),
expect(states).toEqual(
expect.arrayContaining([
expect.objectContaining({
entity_ref: 'component:default/1',
location_key: step.expectedLocationKey,
}),
expect.objectContaining({
entity_ref: 'location:default/fakelocation',
location_key: null,
}),
]),
);
const unprocessed = states.find(
state => state.entity_ref === 'component:default/1',
)!;
const entity = JSON.parse(unprocessed.unprocessed_entity) as Entity;
expect(entity.spec?.type).toEqual(step.expectedTestKey);