aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/specs/components/user_profile.spec.js6
-rw-r--r--test/unit/specs/services/chat_service/chat_service.spec.js17
-rw-r--r--test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js2
3 files changed, 22 insertions, 3 deletions
diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js
index 80092b41..142db73c 100644
--- a/test/unit/specs/components/user_profile.spec.js
+++ b/test/unit/specs/components/user_profile.spec.js
@@ -31,13 +31,15 @@ const testGetters = {
const localUser = {
id: 100,
is_local: true,
- screen_name: 'testUser'
+ screen_name: 'testUser',
+ screen_name_ui: 'testUser'
}
const extUser = {
id: 100,
is_local: false,
- screen_name: 'testUser@test.instance'
+ screen_name: 'testUser@test.instance',
+ screen_name_ui: 'testUser@test.instance'
}
const externalProfileStore = new Vuex.Store({
diff --git a/test/unit/specs/services/chat_service/chat_service.spec.js b/test/unit/specs/services/chat_service/chat_service.spec.js
index 0251cae7..fbbca436 100644
--- a/test/unit/specs/services/chat_service/chat_service.spec.js
+++ b/test/unit/specs/services/chat_service/chat_service.spec.js
@@ -88,4 +88,21 @@ describe('chatService', () => {
expect(view.map(i => i.type)).to.eql(['date', 'message', 'message', 'date', 'message'])
})
})
+
+ describe('.cullOlderMessages', () => {
+ it('keeps 50 newest messages and idIndex matches', () => {
+ const chat = chatService.empty()
+
+ for (let i = 100; i > 0; i--) {
+ // Use decimal values with toFixed to hack together constant length predictable strings
+ chatService.add(chat, { messages: [{ ...message1, id: 'a' + (i / 1000).toFixed(3), idempotency_key: i }] })
+ }
+ chatService.cullOlderMessages(chat)
+ expect(chat.messages.length).to.eql(50)
+ expect(chat.messages[0].id).to.eql('a0.051')
+ expect(chat.minId).to.eql('a0.051')
+ expect(chat.messages[49].id).to.eql('a0.100')
+ expect(Object.keys(chat.idIndex).length).to.eql(50)
+ })
+ })
})
diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
index a3f49b2c..759539e0 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -315,7 +315,7 @@ describe('API Entities normalizer', () => {
it('converts IDN to unicode and marks it as internatonal', () => {
const user = makeMockUserMasto({ acct: 'lain@xn--lin-6cd.com' })
- expect(parseUser(user)).to.have.property('screen_name').that.equal('lain@🌏lаin.com')
+ expect(parseUser(user)).to.have.property('screen_name_ui').that.equal('lain@🌏lаin.com')
})
})