-
Notifications
You must be signed in to change notification settings - Fork 189
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
Improve parser's e2e test #3373
Conversation
@@ -58,10 +58,10 @@ const processFeeds = (feeds) => { | |||
*/ | |||
const processAllFeeds = async () => { | |||
try { | |||
// Get an Array of Feed objects from the wiki feed list and Redis | |||
const [all, wiki] = await Promise.all([Feed.all(), getWikiFeeds()]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feed.all()
and getWikiFeeds()
each returns all feeds => Feed.all()
not needed and easier to test
url: 'http://www.hodgin.ca/?feed=rss2&cat=4', | ||
}, | ||
]; | ||
jest.mock('../../src/utils/wiki-feed-parser', () => jest.fn()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tells The mock factory returns a mocked function so it wouldn't look for __mocks__
const valid = [ | ||
{ | ||
author: 'Tue Nguyen', | ||
url: 'http://localhost:8888/feed.xml', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses feed.xml
from test-web-content
instead of doing real network request
}, | ||
{ | ||
author: 'Jane Doe', | ||
url: 'https://janehasinvalidfeed.com/feed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these urls don't exist/are invalid => response is fast shouldn't affect test's time
c23a74b
to
f60bc91
Compare
@@ -94,6 +94,7 @@ services: | |||
- elasticsearch | |||
- traefik | |||
- redis | |||
restart: unless-stopped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #3369
9044a99
to
5f41574
Compare
5f41574
to
2876e00
Compare
* Use blog from test-web-content * Change invalid url * Specify jest.mock() factory to return mocked function => to not look for __mocks__
2876e00
to
005a92c
Compare
Issue This PR Addresses
Fixes #3369
Fixes #3369
Type of Change
Description
Steps to test the PR
pnpm i
pnpm services:start
pnpm jest:e2e src/api/parser
Checklist