-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathgroup.js
61 lines (52 loc) · 1.53 KB
/
group.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
49
50
51
52
53
54
55
56
57
58
59
60
61
describe('Group', () => {
const router = new Router();
context('class', () => {
it('should be an extension of the SharedGroup', () => {
const newGroup = new Group(router);
expect(newGroup).to.be.an.instanceof(Group);
expect(newGroup).to.be.an.instanceof(SharedGroup);
});
});
context('functionalities', () => {
it('should set and retrieve group name', () => {
const rand = Random.id();
const name = Random.id();
const newGroup = new Group(router, {name});
if (Meteor.isClient) {
newGroup.route(`/${rand}`);
router.go(`/${rand}`);
expect(router.current().route.group.name).to.be.equal(name);
}
});
context('define and go to route', () => {
const prefix = Random.id();
const rand = Random.id();
it('should work with prefix', () => {
const newGroup = new Group(router, {prefix: `/${prefix}`});
let rendered = 0;
newGroup.route(`/${rand}`, {
action() {
rendered++;
}
});
if (Meteor.isClient) {
router.go(`/${prefix}/${rand}`);
expect(rendered).to.be.equal(1);
}
});
it('should work without prefix', () => {
const newGroup = new Group(router);
let rendered = 0;
newGroup.route(`/${rand}`, {
action() {
rendered++;
}
});
if (Meteor.isClient) {
router.go(`/${rand}`);
expect(rendered).to.be.equal(1);
}
});
});
});
});