-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(search): upgrade mongoose, use jest and supertest, and update tests
- Loading branch information
Ijemma Onwuzulike
authored and
Ijemma Onwuzulike
committed
Oct 27, 2022
1 parent
ba5624b
commit 231136c
Showing
29 changed files
with
3,324 additions
and
1,133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"env": { | ||
"es2021": true, | ||
"node": true, | ||
"mocha": true | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"next", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,5 +282,5 @@ yarn start:database | |
in one terminal, and the following in another: | ||
|
||
``` | ||
yarn mocha | ||
yarn jest | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { isEqual } from 'lodash'; | ||
import { NO_PROVIDED_TERM } from '../src/shared/constants/errorMessages'; | ||
import { searchTerm } from './shared/commands'; | ||
|
||
describe('JSON Dictionary', () => { | ||
describe('/GET words', () => { | ||
it.skip('should return back word information', async () => { | ||
const keyword = 'agụū'; | ||
const res = await searchTerm(keyword); | ||
expect(res.status).toEqual(200); | ||
Object.keys(res.body).forEach((key) => { | ||
expect(['(agụū) -gụ', '-gụ agụū', 'agụū mmīli', keyword]).toContain(key); | ||
}); | ||
expect(res.body[keyword][0].wordClass).toEqual('NNC'); | ||
}); | ||
|
||
it('should return an error for searching no word', async () => { | ||
const res = await searchTerm(); | ||
expect(res.status).toEqual(400); | ||
expect(res.body.error).toEqual(NO_PROVIDED_TERM); | ||
}); | ||
|
||
it('should return the same term information', async () => { | ||
const { status, body: normalizeData } = await searchTerm('ndi ndi'); | ||
expect(status).toEqual(200); | ||
const { status: rawStatus, body: rawData } = await searchTerm('ndị ndi'); | ||
expect(rawStatus).toEqual(200); | ||
expect(isEqual(normalizeData, rawData)).toEqual(true); | ||
}); | ||
|
||
it('should return term using variation', async () => { | ||
const res = await searchTerm('-mu-mù'); | ||
expect(res.status).toEqual(200); | ||
expect(res.body['-mụ-mù']).toHaveLength(1); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.