-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook-manager.test.ts
59 lines (54 loc) · 1.69 KB
/
hook-manager.test.ts
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
// import { Application } from './application.ts';
// import { Container } from './container.ts';
// import { HookManager } from './hook-manager.ts';
// const application = new Application(class {});
// const container = new Container();
// class Type {}
//TODO(@DreamTexX): Write tests, but it seems to work lol
/* Deno.test('hook filtering', () => {
const hookManager = new HookManager();
//Accept all:
hookManager.subscribe({}, () => {
console.log('I get called always');
});
//Accept only specific application:
hookManager.subscribe({ application: application }, () => {
console.log(
'I get only called if there is an application that equals my parameter',
);
});
//Accept only specific container:
hookManager.subscribe({ container: container }, () => {
console.log(
'I get only called if there is a container that equals my parameter',
);
});
//Accept only specific type:
hookManager.subscribe({ type: Type }, () => {
console.log(
'I get only called ith there is a type that equals my parameter',
);
});
//Accept only specific scope pre:
hookManager.subscribe({ scope: 'pre' }, () => {
console.log('I get only called if the scope is pre');
});
//Accept only specific scope post:
hookManager.subscribe({ scope: 'post' }, () => {
console.log('I get only called if the scope is post');
});
//Filter for app, container and type
hookManager.subscribe({
application: application,
container: container,
type: Type,
}, () => {
console.log('I get only called if application, container and type matches');
});
hookManager.execute({
container: container,
type: class {},
scope: 'pre',
});
});
*/