fix UrlReaderProcessor test

Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
Kiss Miklos
2022-06-28 10:14:07 +02:00
parent 3117584484
commit 3125f54ad6
@@ -61,7 +61,13 @@ describe('UrlReaderProcessor', () => {
server.use(
rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) =>
res(ctx.set({ ETag: 'my-etag' }), ctx.json({ mock: 'entity' })),
res(
ctx.set({ ETag: 'my-etag' }),
ctx.json({
kind: 'component',
metadata: { name: 'mock-url-entity' },
}),
),
),
);
@@ -78,11 +84,17 @@ describe('UrlReaderProcessor', () => {
expect(emitted[0]).toEqual({
type: 'entity',
location: spec,
entity: { mock: 'entity' },
entity: { kind: 'component', metadata: { name: 'mock-url-entity' } },
});
expect(mockCache.set).toBeCalledWith('v1', {
etag: 'my-etag',
value: [{ type: 'entity', location: spec, entity: { mock: 'entity' } }],
value: [
{
type: 'entity',
location: spec,
entity: { kind: 'component', metadata: { name: 'mock-url-entity' } },
},
],
});
expect(mockCache.set).toBeCalledTimes(1);
});