diff options
| author | Henry Jameson <me@hjkos.com> | 2019-09-08 13:44:29 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-09-08 13:44:29 +0300 |
| commit | db086fe1fdeefdc904f51ee00b2710f089996599 (patch) | |
| tree | 6e4734fc99544da9b34c78700b18c9b02a3f573f /test/unit/specs/components/timeline.spec.js | |
| parent | 5851f97eb058b3e2df91f9122ba899bc7e4affaf (diff) | |
| parent | e75ac9ddbc66a7e3cd40ef130b26b06b8cec9f1d (diff) | |
Merge remote-tracking branch 'upstream/develop' into emoji-selector-update
* upstream/develop: (116 commits)
Password reset page
add a comment
force img updating immediately
Fixed "sequimiento" to "seguimiento".
Replace `/api/externalprofile/show.json` with a MastoAPI equialent
Use mastodon api in follow requests
"Optional" in lowercase.
Update es.json
fix pin/unpin status logic
rename a mutation
update
fix user avatar fallback logic
remove dead code
Corrected "Media Proxy" translation.
Update es.json
make bio textarea resizable vertically only
remove dead code
Make image orientation consistent on FF, fix videos w/ modal
remove dead code
fix crazy watch logic in conversation
...
Diffstat (limited to 'test/unit/specs/components/timeline.spec.js')
| -rw-r--r-- | test/unit/specs/components/timeline.spec.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/specs/components/timeline.spec.js b/test/unit/specs/components/timeline.spec.js new file mode 100644 index 00000000..0c8674a8 --- /dev/null +++ b/test/unit/specs/components/timeline.spec.js @@ -0,0 +1,27 @@ +import { getExcludedStatusIdsByPinning } from 'src/components/timeline/timeline.js' + +describe('Timeline', () => { + describe('getExcludedStatusIdsByPinning', () => { + const mockStatuses = (ids) => ids.map(id => ({ id })) + + 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] + 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', () => { + const pinnedStatusIdSet1 = ['PINNED1', 'PINNED2'] + const pinnedStatusIdSet2 = ['PINNED3', 'PINNED4'] + const pinnedStatusIds = [...pinnedStatusIdSet1, ...pinnedStatusIdSet2] + const statusIds = [...pinnedStatusIdSet1, 'UNPINNED1', ...pinnedStatusIdSet2] + const statuses = mockStatuses(statusIds) + expect(getExcludedStatusIdsByPinning(statuses, pinnedStatusIds)).to.eql(pinnedStatusIdSet1) + }) + }) +}) |
