-
Notifications
You must be signed in to change notification settings - Fork 3
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
Unit Test for Updated MarketCapResolver #594
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
}) | ||
|
||
describe('rankPageIds', () => { | ||
it('should update rank page ids', async () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
}) | ||
|
||
describe('linkWikiToRankData', () => { | ||
it('should link wiki to rank data with valid wikiId', async () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
}) | ||
|
||
describe('rankPageIds', () => { | ||
it('should update rank page ids', async () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
}) | ||
|
||
describe('linkWikiToRankData', () => { | ||
it('should link wiki to rank data with valid wikiId', async () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Code Climate has analyzed commit 389bc19 and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
describe('linkWikiToRankData', () => { | ||
it('should link wiki to rank data with valid wikiId', async () => { | ||
const mockArgs: RankPageIdInputs = { | ||
coingeckoId: 'iqcoin', | ||
wikiId: 'wiki1', | ||
kind: RankType.TOKEN, | ||
} | ||
;(mockMarketCapService.updateMistachIds as jest.Mock).mockResolvedValue( | ||
true, | ||
) | ||
|
||
const result = await marketCapResolver.linkWikiToRankData(mockArgs) | ||
|
||
expect(result).toBe(true) | ||
expect(mockMarketCapService.updateMistachIds).toHaveBeenCalledWith( | ||
mockArgs, | ||
) | ||
}) |
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.
this test, we can also test that the update was successful by checking the updated cache for the changed value
Unit Test for Updated MarketCapResolver
Unit tests for the methods in marketCap.resolver.ts which includes the linkWikiToRankData, using mocks for dependencies to ensure the resolver's logic is tested independently and to ensure the data is updated and that on refresh we also see the updated value.
pnpm test marketCap.resolver.tspec.ts
closes EveripediaNetwork/issues#3243
And
closes EveripediaNetwork/issues#3291