-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
48 lines (37 loc) · 1.18 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
import { expect } from 'chai';
import Starter from './../src/index.js';
describe('Module Starter', () => {
describe('#constructor', () => {
it('should construct and store custom options', () => {
var block = new Starter({
text: 'Peter',
secretValue: 'nonEncryptedSecret'
});
expect(block.text).to.equal('Peter');
expect(block.secretValue).to.equal('nonEncryptedSecret');
});
});
describe('update', () => {
it('should update the output and fire updated', async() => {
//construct block
var block = new Starter({
text: 'Peter'
});
const output = await execute(block);
//check output line
expect(output.short_text).to.equal('Peter');
expect(output.full_text).to.equal('Peter');
});
});
})
//copied from i3-status
async function execute(block) {
return await new Promise(resolve => {
block.on('updated', async(target, output) => {
clearInterval(target.interval);
resolve(output);
});
block.update();
});
}