Skip to content

Commit

Permalink
Update handleAvRoute.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
amoore108 committed Aug 19, 2024
1 parent f53512c commit d75faf0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions ws-nextjs-app/pages/[service]/av-embeds/handleAvRoute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ import handleAvRoute from './handleAvRoute';

const mockGetServerSidePropsContext = {
req: {
cookies: {},
headers: {},
},
res: {
setHeader: jest.fn(),
},
query: {
service: 'news',
},
} as unknown as GetServerSidePropsContext;

describe('Handle AV Route', () => {
Expand All @@ -20,13 +16,13 @@ describe('Handle AV Route', () => {
});

it('should set the cache control header correctly for a Syndication route', async () => {
const { req, res, query } = mockGetServerSidePropsContext;
const { req, res } = mockGetServerSidePropsContext;

await handleAvRoute({
req,
res,
resolvedUrl: '/news/av-embeds/123',
query,
query: { service: 'news' },
});

expect(mockGetServerSidePropsContext.res.setHeader).toHaveBeenCalledWith(
Expand All @@ -36,13 +32,13 @@ describe('Handle AV Route', () => {
});

it('should set the cache control header correctly for a non-Syndication route', async () => {
const { req, res, query } = mockGetServerSidePropsContext;
const { req, res } = mockGetServerSidePropsContext;

await handleAvRoute({
req,
res,
resolvedUrl: '/ws/av-embeds/123',
query,
query: {},
});

expect(mockGetServerSidePropsContext.res.setHeader).toHaveBeenCalledWith(
Expand Down

0 comments on commit d75faf0

Please sign in to comment.