mirror of
https://git.youjo.love/youjo/youjo-fe.git
synced 2024-11-20 05:49:54 +01:00
update unit test
This commit is contained in:
parent
d785ed5a05
commit
18a41e785e
1 changed files with 6 additions and 8 deletions
|
@ -4,17 +4,15 @@ describe('Timeline', () => {
|
|||
describe('getExcludedStatusIdsByPinning', () => {
|
||||
const mockStatuses = (ids) => ids.map(id => ({ id }))
|
||||
|
||||
it('should not return any unpinned status ids', () => {
|
||||
const statuses = mockStatuses([1, 2, 3, 4])
|
||||
const pinnedStatusIds = [1, 3, 5]
|
||||
expect(pinnedStatusIds).to.include.members(getExcludedStatusIdsByPinning(statuses, pinnedStatusIds))
|
||||
})
|
||||
|
||||
it('should not return any status ids not listed in the given statuses', () => {
|
||||
it('should return only members of both pinnedStatusIds and ids of the given statuses', () => {
|
||||
const statusIds = [1, 2, 3, 4]
|
||||
const statuses = mockStatuses(statusIds)
|
||||
const pinnedStatusIds = [1, 3, 5]
|
||||
expect(statusIds).to.include.members(getExcludedStatusIdsByPinning(statuses, pinnedStatusIds))
|
||||
const result = getExcludedStatusIdsByPinning(statuses, pinnedStatusIds)
|
||||
result.forEach(item => {
|
||||
expect(item).to.be.oneOf(statusIds)
|
||||
expect(item).to.be.oneOf(pinnedStatusIds)
|
||||
})
|
||||
})
|
||||
|
||||
it('should return ids of pinned statuses not posted before any unpinned status', () => {
|
||||
|
|
Loading…
Reference in a new issue