-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
list.js
33 lines (25 loc) · 1.12 KB
/
list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* global describe it beforeEach */
if (require('cluster').isWorker) process.exit()
require('../../general.js')
const db = require('../../general.js').db
const message = require('../../general.js').message
// users
const owner = { username: 'soge__' }
describe('Alias - list()', () => {
beforeEach(async () => {
await db.cleanup()
await message.prepare()
})
it('empty list', async () => {
global.systems.alias.list(global.systems.alias, owner, '')
await message.isSent('alias.list-is-empty', owner, { sender: owner.username })
})
it('populated list', async () => {
global.systems.alias.add(global.systems.alias, owner, 'viewer !a !me')
await message.isSent('alias.alias-was-added', owner, { alias: 'a', command: 'me', sender: owner.username })
global.systems.alias.add(global.systems.alias, owner, 'viewer !b !me')
await message.isSent('alias.alias-was-added', owner, { alias: 'b', command: 'me', sender: owner.username })
global.systems.alias.list(global.systems.alias, owner, '')
await message.isSent('alias.list-is-not-empty', owner, { list: '!a, !b', sender: owner.username })
})
})