-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsingleton.test.ts
More file actions
43 lines (35 loc) · 930 Bytes
/
singleton.test.ts
File metadata and controls
43 lines (35 loc) · 930 Bytes
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
import { should } from 'chai'; should();
import singleton from '../singleton';
import { Composition } from '../composition';
describe('singleton()', () => {
it('should create an instance of given agent class.', done => {
@singleton()
class C extends Composition {
constructor() { super({outputs: []})}
build(){}
wire(){
done();
}
}
C;
});
it('should invoke the `.bind()` function if it exists.', done => {
@singleton()
class C extends Composition {
constructor() { super({outputs: []})}
build(){}
wire(){}
bind() { done(); return super.bind(); }
}
C;
});
it('should put the instance in `.instance` static member.', () => {
@singleton()
class C extends Composition {
constructor() { super({outputs: []})}
build(){}
wire(){}
}
(C as any).instance.should.be.instanceof(Composition);
});
});