consistency in tests too

This commit is contained in:
Henry Jameson 2019-01-17 19:27:57 +03:00
parent 9682ee66ce
commit a2ef716f3b
2 changed files with 20 additions and 20 deletions

View file

@ -82,7 +82,7 @@ describe('The Statuses module', () => {
const status = makeMockStatus({id: '1'}) const status = makeMockStatus({id: '1'})
const otherStatus = makeMockStatus({id: '3'}) const otherStatus = makeMockStatus({id: '3'})
status.uri = 'xxx' 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.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.'
deletion.uri = 'xxx' deletion.uri = 'xxx'
@ -131,9 +131,9 @@ describe('The Statuses module', () => {
it('splits retweets from their status and links them', () => { it('splits retweets from their status and links them', () => {
const state = cloneDeep(defaultState) const state = cloneDeep(defaultState)
const status = makeMockStatus({id: 1}) const status = makeMockStatus({id: '1'})
const retweet = makeMockStatus({id: 2, type: 'retweet'}) const retweet = makeMockStatus({id: '2', type: 'retweet'})
const modStatus = makeMockStatus({id: 1, text: 'something else'}) const modStatus = makeMockStatus({id: '1', text: 'something else'})
retweet.retweeted_status = status retweet.retweeted_status = status
@ -173,9 +173,9 @@ describe('The Statuses module', () => {
it('replaces existing statuses with the same id, coming from a retweet', () => { it('replaces existing statuses with the same id, coming from a retweet', () => {
const state = cloneDeep(defaultState) const state = cloneDeep(defaultState)
const status = makeMockStatus({id: 1}) const status = makeMockStatus({id: '1'})
const modStatus = makeMockStatus({id: 1, text: 'something else'}) const modStatus = makeMockStatus({id: '1', text: 'something else'})
const retweet = makeMockStatus({id: 2, type: 'retweet'}) const retweet = makeMockStatus({id: '2', type: 'retweet'})
retweet.retweeted_status = modStatus retweet.retweeted_status = modStatus
// Add original status // Add original status
@ -197,7 +197,7 @@ describe('The Statuses module', () => {
const status = makeMockStatus({id: '1'}) const status = makeMockStatus({id: '1'})
const favorite = { const favorite = {
id: 2, id: '2',
type: 'favorite', type: 'favorite',
in_reply_to_status_id: '1', // The API uses strings here... in_reply_to_status_id: '1', // The API uses strings here...
uri: 'tag:shitposter.club,2016-08-21:fave:3895:note:773501:2016-08-21T16:52:15+00:00', uri: 'tag:shitposter.club,2016-08-21:fave:3895:note:773501:2016-08-21T16:52:15+00:00',
@ -225,7 +225,7 @@ describe('The Statuses module', () => {
} }
const ownFavorite = { const ownFavorite = {
id: 3, id: '3',
type: 'favorite', type: 'favorite',
in_reply_to_status_id: '1', // The API uses strings here... in_reply_to_status_id: '1', // The API uses strings here...
uri: 'tag:shitposter.club,2016-08-21:fave:3895:note:773501:2016-08-21T16:52:15+00:00', uri: 'tag:shitposter.club,2016-08-21:fave:3895:note:773501:2016-08-21T16:52:15+00:00',
@ -251,7 +251,7 @@ describe('The Statuses module', () => {
mentionedStatus.uri = 'xxx' mentionedStatus.uri = 'xxx'
otherStatus.attentions = [user] 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.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.'
deletion.uri = 'xxx' deletion.uri = 'xxx'
@ -260,8 +260,8 @@ describe('The Statuses module', () => {
state, state,
{ {
notifications: [{ notifications: [{
from_profile: { id: 2 }, from_profile: { id: '2' },
id: 998, id: '998',
type: 'mention', type: 'mention',
status: otherStatus, status: otherStatus,
action: otherStatus, action: otherStatus,
@ -274,8 +274,8 @@ describe('The Statuses module', () => {
state, state,
{ {
notifications: [{ notifications: [{
from_profile: { id: 2 }, from_profile: { id: '2' },
id: 999, id: '999',
type: 'mention', type: 'mention',
status: mentionedStatus, status: mentionedStatus,
action: mentionedStatus, action: mentionedStatus,

View file

@ -9,7 +9,7 @@ const makeMockStatusQvitter = (overrides = {}) => {
external_url: 'https://ap.example/whatever', external_url: 'https://ap.example/whatever',
fave_num: 1, fave_num: 1,
favorited: false, favorited: false,
id: 10335970, id: '10335970',
in_reply_to_ostatus_uri: null, in_reply_to_ostatus_uri: null,
in_reply_to_profileurl: null, in_reply_to_profileurl: null,
in_reply_to_screen_name: null, in_reply_to_screen_name: null,
@ -20,7 +20,7 @@ const makeMockStatusQvitter = (overrides = {}) => {
possibly_sensitive: false, possibly_sensitive: false,
repeat_num: 0, repeat_num: 0,
repeated: false, repeated: false,
statusnet_conversation_id: 16300488, statusnet_conversation_id: '16300488',
statusnet_html: '<p>haha benis</p>', statusnet_html: '<p>haha benis</p>',
summary: null, summary: null,
tags: [], tags: [],
@ -45,7 +45,7 @@ const makeMockUserQvitter = (overrides = {}) => {
following: true, following: true,
follows_you: true, follows_you: true,
friends_count: 1, friends_count: 1,
id: 60717, id: '60717',
is_local: false, is_local: false,
locked: false, locked: false,
name: 'Spurdo :ebin:', name: 'Spurdo :ebin:',
@ -87,15 +87,15 @@ describe('QVitter preprocessing', () => {
}) })
it('sets nsfw for statuses with the #nsfw tag', () => { it('sets nsfw for statuses with the #nsfw tag', () => {
const safe = makeMockStatusQvitter({id: 1, text: 'Hello oniichan'}) const safe = makeMockStatusQvitter({id: '1', text: 'Hello oniichan'})
const nsfw = makeMockStatusQvitter({id: 1, text: 'Hello oniichan #nsfw'}) const nsfw = makeMockStatusQvitter({id: '1', text: 'Hello oniichan #nsfw'})
expect(parseStatus(safe).nsfw).to.eq(false) expect(parseStatus(safe).nsfw).to.eq(false)
expect(parseStatus(nsfw).nsfw).to.eq(true) expect(parseStatus(nsfw).nsfw).to.eq(true)
}) })
it('leaves existing nsfw settings alone', () => { it('leaves existing nsfw settings alone', () => {
const nsfw = makeMockStatusQvitter({id: 1, text: 'Hello oniichan #nsfw', nsfw: false}) const nsfw = makeMockStatusQvitter({id: '1', text: 'Hello oniichan #nsfw', nsfw: false})
expect(parseStatus(nsfw).nsfw).to.eq(false) expect(parseStatus(nsfw).nsfw).to.eq(false)
}) })