Skip to content

Commit

Permalink
remove outdated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored and justinkambic committed Dec 8, 2023
1 parent ea26749 commit 36f2aef
Showing 1 changed file with 0 additions and 88 deletions.
Expand Up @@ -105,94 +105,6 @@ describe('journey screenshot route', () => {
expect(response.body.screenshotRef).toEqual(mock);
});

it('returns full screenshot blob', async () => {
const mock = {
synthetics: {
blob: 'a blob',
blob_mime: 'image/jpeg',
step: {
name: 'a step name',
},
type: 'step/screenshot',
},
};

handlerContext.uptimeEsClient.search = jest.fn().mockResolvedValue({
body: {
hits: {
total: {
value: 3,
},
hits: [],
},
aggregations: { step: { image: { hits: { hits: [{ _source: mock }] } } } },
},
});

const route = createJourneyScreenshotRoute({
requests: {
getJourneyScreenshot: jest.fn().mockReturnValue(mock),
},
} as unknown as UMServerLibs);

expect(await route.handler(handlerContext as any)).toMatchInlineSnapshot(`
Object {
"body": Object {
"data": Array [
105,
185,
104,
],
"type": "Buffer",
},
"headers": Object {
"cache-control": "max-age=600",
"caption-name": "a step name",
"content-type": "image/jpeg",
"max-steps": "3",
},
"message": "Ok",
"status": 200,
}
`);
});

it('defaults to png when mime is undefined', async () => {
const mock = {
synthetics: {
blob: 'a blob',
step: {
name: 'a step name',
},
type: 'step/screenshot',
},
};
handlerContext.uptimeEsClient.search = jest.fn().mockResolvedValue({
body: {
hits: {
total: {
value: 3,
},
hits: [],
},
aggregations: { step: { image: { hits: { hits: [{ _source: mock }] } } } },
},
});
const route = createJourneyScreenshotRoute({
requests: {
getJourneyScreenshot: jest.fn().mockReturnValue(mock),
},
} as unknown as UMServerLibs);

const response = (await route.handler(
handlerContext as any
)) as IKibanaResponse<ClientContract>;

expect(response.status).toBe(200);
// @ts-expect-error incomplete implementation for testing
expect(response.headers['content-type']).toBe('image/png');
});

it('returns 404 for screenshot missing blob', async () => {
const route = createJourneyScreenshotRoute({
requests: {
Expand Down

0 comments on commit 36f2aef

Please sign in to comment.