-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(taxonomy): added metadata options endpoint (#3678)
* feat(taxonomy): added metadata options endpoint * feat(taxonomy): fixed flow errors * feat(taxonomy): added unit test for getMetadataOptionsUrl * feat(taxonomy): removed unused variable * feat(taxonomy): added doc block * feat(taxonomy): added marker in test * feat(taxonomy): updated abort logic * feat(taxonomy): changed abort class * feat(taxonomy): improved abort handling * feat(taxonomy): test enhancements * feat(taxonomy): simplified function call * feat(taxonomy): added level in query string params * feat(taxonomy): updated test
- Loading branch information
1 parent
5c54eb5
commit 47ba331
Showing
7 changed files
with
259 additions
and
2 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
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 |
---|---|---|
@@ -1,11 +1,29 @@ | ||
import { formatComment } from '../utils'; | ||
import Xhr from '../../utils/Xhr'; | ||
import { getAbortError } from '../../utils/error'; | ||
import { formatComment, handleOnAbort } from '../utils'; | ||
import { threadedComments, threadedCommentsFormatted } from '../fixtures'; | ||
|
||
jest.mock('../../utils/Xhr', () => { | ||
return jest.fn().mockImplementation(() => ({ | ||
abort: jest.fn(), | ||
})); | ||
}); | ||
|
||
describe('api/utils', () => { | ||
describe('formatComment()', () => { | ||
test('should return a comment and its replies with tagged_message property equal to message', () => { | ||
expect(formatComment(threadedComments[0])).toMatchObject(threadedCommentsFormatted[0]); | ||
expect(formatComment(threadedComments[1])).toMatchObject(threadedCommentsFormatted[1]); | ||
}); | ||
}); | ||
|
||
describe('handleOnAbort()', () => { | ||
test('should abort and throw when called', async () => { | ||
const xhr = new Xhr(); | ||
|
||
await expect(() => handleOnAbort(xhr)).toThrow(getAbortError()); | ||
|
||
expect(xhr.abort).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
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
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