specific assertions

This commit is contained in:
Henry Jameson 2026-08-04 20:18:30 +03:00
commit c1830f4b97
4 changed files with 17 additions and 17 deletions

View file

@ -66,10 +66,10 @@ describe('ChatView methods', () => {
it("Doesn't add duplicates", () => {
component.vm.addMessages({ messages: [message1] })
component.vm.addMessages({ messages: [message1] })
expect(component.vm.messages.length).to.eql(1)
expect(component.vm.messages).to.have.length(1)
component.vm.addMessages({ messages: [message2] })
expect(component.vm.messages.length).to.eql(2)
expect(component.vm.messages).to.have.length(2)
})
it('Updates minId and lastMessage and newMessageCount', async () => {
@ -127,11 +127,11 @@ describe('ChatView methods', () => {
})
}
component.vm.cullOlder()
expect(component.vm.messages.length).to.eql(50)
expect(component.vm.messages).to.have.length(50)
expect(component.vm.messages[0].id).to.eql('a0.051')
expect(component.vm.minId).to.eql('a0.051')
expect(component.vm.messages[49].id).to.eql('a0.100')
expect(Object.keys(component.vm.messagesIndex).length).to.eql(50)
expect(Object.keys(component.vm.messagesIndex)).to.have.length(50)
})
})
})

View file

@ -278,7 +278,7 @@ describe('Statuses module', () => {
timeline: 'public',
})
expect(state.timelines.public.visibleStatuses.length).to.eql(1)
expect(state.timelines.public.visibleStatuses).to.have.length(1)
expect(state.timelines.public.visibleStatuses[0].fave_num).to.eql(1)
expect(state.timelines.public.maxId).to.eq(favorite.id)
@ -289,7 +289,7 @@ describe('Statuses module', () => {
timeline: 'public',
})
expect(state.timelines.public.visibleStatuses.length).to.eql(1)
expect(state.timelines.public.visibleStatuses).to.have.length(1)
expect(state.timelines.public.visibleStatuses[0].fave_num).to.eql(1)
expect(state.timelines.public.maxId).to.eq(favorite.id)
@ -314,7 +314,7 @@ describe('Statuses module', () => {
user,
})
expect(state.timelines.public.visibleStatuses.length).to.eql(1)
expect(state.timelines.public.visibleStatuses).to.have.length(1)
expect(state.timelines.public.visibleStatuses[0].fave_num).to.eql(1)
expect(state.timelines.public.visibleStatuses[0].favorited).to.eql(true)
})
@ -406,7 +406,7 @@ describe('Statuses module', () => {
emoji: '😂',
currentUser: { id: 'me' },
})
expect(state.allStatusesObject['1'].emoji_reactions.length).to.eql(0)
expect(state.allStatusesObject['1'].emoji_reactions).to.have.length(0)
})
})
@ -428,7 +428,7 @@ describe('Statuses module', () => {
state.timelines.public.minId = '5'
mutations.showNewStatuses(state, { timeline: 'public' })
expect(state.timelines.public.visibleStatuses.length).to.eql(2)
expect(state.timelines.public.visibleStatuses).to.have.length(2)
expect(state.timelines.public.minVisibleId).to.equal('10')
expect(state.timelines.public.minId).to.equal('10')
})

View file

@ -125,7 +125,7 @@ describe('The SyncConfig store', () => {
},
})
expect(store.prefsStorage._journal.length).to.eql(500)
expect(store.prefsStorage._journal).to.have.length(500)
})
it('should reset local timestamp to remote if contents are the same', async () => {
@ -173,7 +173,7 @@ describe('The SyncConfig store', () => {
}
store.setPreference({ path: 'simple.palette', value: '1' })
expect(store.prefsStorage.simple.palette).to.eql('1')
expect(store.prefsStorage._journal.length).to.eql(1)
expect(store.prefsStorage._journal).to.have.length(1)
expect(store.prefsStorage._journal[0]).to.eql({
path: 'simple.palette',
operation: 'set',
@ -199,7 +199,7 @@ describe('The SyncConfig store', () => {
store.updateCache({ username: 'test' })
expect(store.prefsStorage.simple.palette).to.eql(2)
expect(store.prefsStorage.collections.palette).to.eql([])
expect(store.prefsStorage._journal.length).to.eql(2)
expect(store.prefsStorage._journal).to.have.length(2)
expect(store.prefsStorage._journal[0]).to.eql({
path: 'simple.palette',
operation: 'set',
@ -229,7 +229,7 @@ describe('The SyncConfig store', () => {
store.updateCache({ username: 'test' })
expect(store.prefsStorage.simple.palette).to.eql(1)
expect(store.prefsStorage.collections.palette).to.eql([2])
expect(store.prefsStorage._journal.length).to.eql(2)
expect(store.prefsStorage._journal).to.have.length(2)
})
// TODO We need a proper test for object-based stores
@ -245,7 +245,7 @@ describe('The SyncConfig store', () => {
expect(store.prefsStorage.simple.fontInput).to.not.have.property(
'family',
)
expect(store.prefsStorage._journal.length).to.eql(1)
expect(store.prefsStorage._journal).to.have.length(1)
})
it('should not allow unsetting depth <= 2', () => {

View file

@ -55,7 +55,7 @@ describe('The UserHighlight store', () => {
user: 'highlight@testing',
type: 'test',
})
expect(store.highlight._journal.length).to.eql(1)
expect(store.highlight._journal).to.have.length(1)
expect(store.highlight._journal[0]).to.eql({
user: 'highlight@testing',
operation: 'set',
@ -74,7 +74,7 @@ describe('The UserHighlight store', () => {
user: 'highlight@testing.xyz',
type: 'test',
})
expect(store.highlight._journal.length).to.eql(1)
expect(store.highlight._journal).to.have.length(1)
expect(store.highlight._journal[0]).to.eql({
user: 'highlight@testing.xyz',
operation: 'set',
@ -98,7 +98,7 @@ describe('The UserHighlight store', () => {
user: 'a@test.xyz',
type: 'foo',
})
expect(store.highlight._journal.length).to.eql(1)
expect(store.highlight._journal).to.have.length(1)
})
})
})