Commit 18a41e78 authored by Tae Hoon's avatar Tae Hoon

update unit test

parent d785ed5a
...@@ -4,17 +4,15 @@ describe('Timeline', () => { ...@@ -4,17 +4,15 @@ describe('Timeline', () => {
describe('getExcludedStatusIdsByPinning', () => { describe('getExcludedStatusIdsByPinning', () => {
const mockStatuses = (ids) => ids.map(id => ({ id })) const mockStatuses = (ids) => ids.map(id => ({ id }))
it('should not return any unpinned status ids', () => { it('should return only members of both pinnedStatusIds and ids of the given statuses', () => {
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', () => {
const statusIds = [1, 2, 3, 4] const statusIds = [1, 2, 3, 4]
const statuses = mockStatuses(statusIds) const statuses = mockStatuses(statusIds)
const pinnedStatusIds = [1, 3, 5] 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', () => { it('should return ids of pinned statuses not posted before any unpinned status', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment