Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump babel-jest to 27.3.1 #2425

Merged
merged 1 commit into from
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@typescript-eslint/eslint-plugin": "4.17.0",
"@typescript-eslint/parser": "4.17.0",
"@vercel/node": "1.9.1",
"babel-jest": "26.6.3",
"babel-jest": "27.3.1",
"babel-preset-next": "1.4.0",
"cross-env": "7.0.3",
"eslint": "7.23.0",
Expand All @@ -115,17 +115,17 @@
"eslint-plugin-react-hooks": "4.2.0",
"fast-xml-parser": "3.19.0",
"husky": "5.1.3",
"jest": "26.6.3",
"jest": "27.3.1",
"jest-fetch-mock": "3.0.3",
"jest-playwright-preset": "1.5.2",
"jest-playwright-preset": "1.7.0",
"nock": "13.0.11",
"npm-run-all": "4.1.5",
"playwright": "1.11.0",
"prettier": "2.2.1",
"pretty-quick": "3.1.0",
"run.env": "1.1.0",
"supertest": "6.1.3",
"ts-jest": "26.5.4"
"ts-jest": "27.0.7"
},
"engines": {
"node": ">=12.0.0"
Expand Down
9 changes: 3 additions & 6 deletions src/api/feed-discovery/test/middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('POST /', () => {
});

describe('Test checkValidBlog middleware', () => {
it('should return 200 if the blog page responds with 200', async (done) => {
it('should return 200 if the blog page responds with 200', async () => {
const validBlogUrl = 'https://existblogpage.com/';
const mockBody = '<p>ok</p>';
nock(validBlogUrl).get('/').reply(200, mockBody, {
Expand All @@ -66,10 +66,9 @@ describe('POST /', () => {
await middleware(mockReq, mockRes, mockNextFunction);
expect(mockNextFunction).toHaveBeenCalledTimes(1);
expect(mockRes.locals.document).toEqual(mockBody);
done();
});

it('should return 400 if the blog page responds with code other than 200', async (done) => {
it('should return 400 if the blog page responds with code other than 200', async () => {
const invalidBlogUrl = 'https://notexistblogpage.com/';
nock(invalidBlogUrl).get('/').reply(404);

Expand All @@ -87,10 +86,9 @@ describe('POST /', () => {
await middleware(mockReq, mockRes, mockNextFunction);
const expectedError = createError(createError(400, 'Unable to Check Blog'));
expect(mockNextFunction).toBeCalledWith(expectedError);
done();
});

it('should return 400 if the blog page responds with content type other than text/html', async (done) => {
it('should return 400 if the blog page responds with content type other than text/html', async () => {
const invalidBlogUrl = 'https://nothtmlresponse.com/';
nock(invalidBlogUrl).get('/').reply(200, null, {
'Content-Type': 'text/xml',
Expand All @@ -111,7 +109,6 @@ describe('POST /', () => {
expect(mockNextFunction).toHaveBeenCalledTimes(1);
const expectedError = createError(createError(400, 'Invalid Blog'));
expect(mockNextFunction).toBeCalledWith(expectedError);
done();
});
});

Expand Down
18 changes: 6 additions & 12 deletions src/api/feed-discovery/test/router.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('POST /', () => {
});

describe('Test the API returns feed URLs correctly', () => {
it('should return 200 and 1 rss+xml feed url if there is one link of type="application/rss+xml"', async (done) => {
it('should return 200 and 1 rss+xml feed url if there is one link of type="application/rss+xml"', async () => {
const blogUrl = 'https://test321.blogspot.com/';
const mockBlogUrlResponseBody = `
<html lang="en">
Expand All @@ -36,10 +36,9 @@ describe('POST /', () => {
.send({ blogUrl });
expect(res.status).toBe(200);
expect(res.body).toEqual(result);
done();
});

it('should return 200 and 1 atom+xml feed url if there is 1 link of type="application/atom+xml"', async (done) => {
it('should return 200 and 1 atom+xml feed url if there is 1 link of type="application/atom+xml"', async () => {
const blogUrl = 'https://test321.blogspot.com/';
const mockBlogUrlResponseBody = `
<html lang="en">
Expand All @@ -65,10 +64,9 @@ describe('POST /', () => {
.send({ blogUrl });
expect(res.status).toBe(200);
expect(res.body).toEqual(result);
done();
});

it('should return 200 and 1 json+oembed feed url if there is 1 link of type="application/json+oembed"', async (done) => {
it('should return 200 and 1 json+oembed feed url if there is 1 link of type="application/json+oembed"', async () => {
const blogUrl = 'https://test321.blogspot.com/';
const mockBlogUrlResponseBody = `
<html lang="en">
Expand All @@ -94,10 +92,9 @@ describe('POST /', () => {
.send({ blogUrl });
expect(res.status).toBe(200);
expect(res.body).toEqual(result);
done();
});

it('should return 200 and 1 xml+oembed feed url if there is 1 link of type="application/xml+oembed"', async (done) => {
it('should return 200 and 1 xml+oembed feed url if there is 1 link of type="application/xml+oembed"', async () => {
const blogUrl = 'https://test321.blogspot.com/';
const mockBlogUrlResponseBody = `
<html lang="en">
Expand All @@ -123,10 +120,9 @@ describe('POST /', () => {
.send({ blogUrl });
expect(res.status).toBe(200);
expect(res.body).toEqual(result);
done();
});

it('should return 200 and all feed urls if there are multiple link elements that could contain a feed url', async (done) => {
it('should return 200 and all feed urls if there are multiple link elements that could contain a feed url', async () => {
const blogUrl = 'https://test321.blogspot.com/';
const mockBlogUrlResponseBody = `
<!doctype html>
Expand Down Expand Up @@ -163,13 +159,11 @@ describe('POST /', () => {
.send({ blogUrl });
expect(res.status).toBe(200);
expect(res.body).toEqual(result);
done();
});

it('should return 401 if no authorization token is included in headers', async (done) => {
it('should return 401 if no authorization token is included in headers', async () => {
const res = await request(app).post('/').send({ blogUrl: 'https://test321.blogspot.com/' });
expect(res.status).toBe(401);
done();
});
});
});