提交 c0a69986 编写于 作者: ruiruibupt's avatar ruiruibupt

add test data

上级 39e1955a
......@@ -18,6 +18,7 @@ test('Contact smoke testing', async t => {
/* tslint:disable:variable-name */
const UserName = '@0bb3e4dd746fdbd4a80546aef66f4085'
const NickName = 'Nick Name Test'
const RemarkName = 'Alias Test'
// Mock
const mockContactGetter = function (id) {
......@@ -27,6 +28,7 @@ test('Contact smoke testing', async t => {
return resolve({
UserName: UserName
, NickName: NickName
, RemarkName: RemarkName
})
}, 200)
})
......@@ -38,6 +40,8 @@ test('Contact smoke testing', async t => {
const r = await c.ready(mockContactGetter)
t.is(r.get('id') , UserName, 'UserName set')
t.is(r.get('name') , NickName, 'NickName set')
t.is(r.name(), NickName, 'should get the right name from Contact')
t.is(r.alias(), RemarkName, 'should get the right alias from Contact')
const s = r.toString()
t.is(typeof s, 'string', 'toString()')
......
......@@ -109,11 +109,17 @@ test('Room smoking test', async t => {
const contact1 = new Contact(EXPECTED.memberId1)
const nick1 = r.nick(contact1)
t.is(nick1, EXPECTED.memberNick1, 'should get nick1 from DisplayName')
t.is(nick1, EXPECTED.memberNick1, 'should get nick1 from roomAlias')
const name1 = r.name(contact1)
t.is(name1, EXPECTED.memberNick1, 'should get name1 from roomAlias')
const contact2 = new Contact(EXPECTED.memberId2)
const nick2 = r.nick(contact2)
t.is(nick2, EXPECTED.memberNick2, 'should get nick2 from NickName because there is no DisplayName, ')
t.is(nick2, EXPECTED.memberNick2, 'should get nick2 from name because there is no roomAlias, ')
const name2 = r.name(contact2)
t.is(name2, EXPECTED.memberNick2, 'should get nick2 from name because there is no roomAlias, ')
t.truthy(r.has(contact1), 'should has contact1')
const noSuchContact = new Contact('not exist id')
......@@ -131,9 +137,9 @@ test('Room smoking test', async t => {
if (!contactA || !contactB || !contactC) {
throw new Error('no a or b')
}
t.is(contactA.id, EXPECTED.memberId1, 'should get the right id from nick 1, find member by nickName')
t.is(contactB.id, EXPECTED.memberId2, 'should get the right id from nick 2, find member by displayName')
t.is(contactC.id, EXPECTED.memberId3, 'should get the right id from nick 3, find member by remark')
t.is(contactA.id, EXPECTED.memberId1, 'should get the right id from nick 1, find member by name')
t.is(contactB.id, EXPECTED.memberId2, 'should get the right id from nick 2, find member by roomAlias')
t.is(contactC.id, EXPECTED.memberId3, 'should get the right id from nick 3, find member by alias')
const s = r.toString()
t.is(typeof s, 'string', 'toString()')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册