diff options
| author | Henry Jameson <me@hjkos.com> | 2019-08-31 22:38:02 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-08-31 22:38:02 +0300 |
| commit | 18ec13d796c0928d09fa93de4117822d2e35502c (patch) | |
| tree | 1cfb4d68a246c604396bb64bbba3e69bdf4fe511 /test/unit/specs/modules/statuses.spec.js | |
| parent | b3e9a5a71819c7d3a4b35c5b6ad551785a7ba44f (diff) | |
| parent | 018a650166a5dce0878b696359a999ab67634cfc (diff) | |
Merge remote-tracking branch 'upstream/develop' into docs
* upstream/develop: (193 commits)
fix user avatar fallback logic
remove dead code
make bio textarea resizable vertically only
remove dead code
remove dead code
fix crazy watch logic in conversation
show three dot button only if needed
hide mute conversation button to guests
update keyBy
generate idObj at timeline level
fix pin showing logic in conversation
Show a message when JS is disabled
Initialize chat only if user is logged in and it wasn't initialized before
i18n/Update Japanese
i18n/Update pedantic Japanese
sync profile tab state with location query
refactor TabSwitcher
use better name of controlled prop
fix potential bug to render active tab in controlled way
remove unused param
...
Diffstat (limited to 'test/unit/specs/modules/statuses.spec.js')
| -rw-r--r-- | test/unit/specs/modules/statuses.spec.js | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js index 0bbcb25a..f794997b 100644 --- a/test/unit/specs/modules/statuses.spec.js +++ b/test/unit/specs/modules/statuses.spec.js @@ -1,10 +1,10 @@ import { defaultState, mutations, prepareStatus } from '../../../../src/modules/statuses.js' // eslint-disable-next-line camelcase -const makeMockStatus = ({id, text, type = 'status'}) => { +const makeMockStatus = ({ id, text, type = 'status' }) => { return { id, - user: {id: '0'}, + user: { id: '0' }, name: 'status', text: text || `Text number ${id}`, fave_num: 0, @@ -17,7 +17,7 @@ const makeMockStatus = ({id, text, type = 'status'}) => { describe('Statuses module', () => { describe('prepareStatus', () => { it('sets deleted flag to false', () => { - const aStatus = makeMockStatus({id: '1', text: 'Hello oniichan'}) + const aStatus = makeMockStatus({ id: '1', text: 'Hello oniichan' }) expect(prepareStatus(aStatus).deleted).to.eq(false) }) }) @@ -25,7 +25,7 @@ describe('Statuses module', () => { describe('addNewStatuses', () => { it('adds the status to allStatuses and to the given timeline', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'public' }) @@ -37,7 +37,7 @@ describe('Statuses module', () => { it('counts the status as new if it has not been seen on this timeline', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'public' }) mutations.addNewStatuses(state, { statuses: [status], timeline: 'friends' }) @@ -55,7 +55,7 @@ describe('Statuses module', () => { it('add the statuses to allStatuses if no timeline is given', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status] }) @@ -67,7 +67,7 @@ describe('Statuses module', () => { it('adds the status to allStatuses and to the given timeline, directly visible', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) @@ -79,10 +79,10 @@ describe('Statuses module', () => { it('removes statuses by tag on deletion', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const otherStatus = makeMockStatus({id: '3'}) + const status = makeMockStatus({ id: '1' }) + const otherStatus = makeMockStatus({ id: '3' }) status.uri = 'xxx' - const deletion = makeMockStatus({id: '2', type: 'deletion'}) + const deletion = makeMockStatus({ id: '2', type: 'deletion' }) deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.' deletion.uri = 'xxx' @@ -97,8 +97,8 @@ describe('Statuses module', () => { it('does not update the maxId when the noIdUpdate flag is set', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const secondStatus = makeMockStatus({id: '2'}) + const status = makeMockStatus({ id: '1' }) + const secondStatus = makeMockStatus({ id: '2' }) mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) expect(state.timelines.public.maxId).to.eql('1') @@ -111,10 +111,10 @@ describe('Statuses module', () => { it('keeps a descending by id order in timeline.visibleStatuses and timeline.statuses', () => { const state = defaultState() - const nonVisibleStatus = makeMockStatus({id: '1'}) - const status = makeMockStatus({id: '3'}) - const statusTwo = makeMockStatus({id: '2'}) - const statusThree = makeMockStatus({id: '4'}) + const nonVisibleStatus = makeMockStatus({ id: '1' }) + const status = makeMockStatus({ id: '3' }) + const statusTwo = makeMockStatus({ id: '2' }) + const statusThree = makeMockStatus({ id: '4' }) mutations.addNewStatuses(state, { statuses: [nonVisibleStatus], showImmediately: false, timeline: 'public' }) @@ -131,9 +131,9 @@ describe('Statuses module', () => { it('splits retweets from their status and links them', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const retweet = makeMockStatus({id: '2', type: 'retweet'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) + const status = makeMockStatus({ id: '1' }) + const retweet = makeMockStatus({ id: '2', type: 'retweet' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) retweet.retweeted_status = status @@ -156,8 +156,8 @@ describe('Statuses module', () => { it('replaces existing statuses with the same id', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) + const status = makeMockStatus({ id: '1' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) // Add original status mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) @@ -173,9 +173,9 @@ describe('Statuses module', () => { it('replaces existing statuses with the same id, coming from a retweet', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) - const modStatus = makeMockStatus({id: '1', text: 'something else'}) - const retweet = makeMockStatus({id: '2', type: 'retweet'}) + const status = makeMockStatus({ id: '1' }) + const modStatus = makeMockStatus({ id: '1', text: 'something else' }) + const retweet = makeMockStatus({ id: '2', type: 'retweet' }) retweet.retweeted_status = modStatus // Add original status @@ -194,7 +194,7 @@ describe('Statuses module', () => { it('handles favorite actions', () => { const state = defaultState() - const status = makeMockStatus({id: '1'}) + const status = makeMockStatus({ id: '1' }) const favorite = { id: '2', @@ -258,11 +258,11 @@ describe('Statuses module', () => { }) describe('clearTimeline', () => { - it('keeps userId when clearing user timeline', () => { + it('keeps userId when clearing user timeline when excludeUserId param is true', () => { const state = defaultState() state.timelines.user.userId = 123 - mutations.clearTimeline(state, { timeline: 'user' }) + mutations.clearTimeline(state, { timeline: 'user', excludeUserId: true }) expect(state.timelines.user.userId).to.eql(123) }) @@ -272,14 +272,14 @@ describe('Statuses module', () => { it('removes a notification when the notice gets removed', () => { const user = { id: '1' } const state = defaultState() - const status = makeMockStatus({id: '1'}) - const otherStatus = makeMockStatus({id: '3'}) - const mentionedStatus = makeMockStatus({id: '2'}) + const status = makeMockStatus({ id: '1' }) + const otherStatus = makeMockStatus({ id: '3' }) + const mentionedStatus = makeMockStatus({ id: '2' }) mentionedStatus.attentions = [user] mentionedStatus.uri = 'xxx' otherStatus.attentions = [user] - const deletion = makeMockStatus({id: '4', type: 'deletion'}) + const deletion = makeMockStatus({ id: '4', type: 'deletion' }) deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.' deletion.uri = 'xxx' |
