1 |
|
2 |
|
3 | const expect = require('chai').expect
|
4 | const tymly = require('./../lib')
|
5 | const path = require('path')
|
6 |
|
7 | describe('Exclude plugins tests', function () {
|
8 | this.timeout(process.env.TIMEOUT || 5000)
|
9 |
|
10 | let tymlyServices, statebox
|
11 |
|
12 | it('boot Tymly and see all plugins', async () => {
|
13 | const ts = await tymly.boot({
|
14 | pluginPaths: path.resolve(__dirname, './fixtures/plugins/*-plugin')
|
15 | })
|
16 |
|
17 | tymlyServices = ts
|
18 | statebox = ts.tymly.bootedServices.statebox
|
19 | })
|
20 |
|
21 | it('Test we\'ve got the thing-that-should-not-be version of the Hello state resource', async () => {
|
22 |
|
23 | const Hello = statebox = statebox.statebox.findModuleByName('hello')
|
24 | const hello = new Hello()
|
25 | const event = {}
|
26 | const context = {
|
27 | sendTaskSuccess: function () {}
|
28 | }
|
29 | hello.run(event, context)
|
30 | expect(event.greeting).to.eql('HELLO, I SHOULD NOT BE...')
|
31 | })
|
32 |
|
33 | it('First Tymly shutdown', async () => {
|
34 | await tymlyServices.tymly.shutdown()
|
35 | })
|
36 |
|
37 | it('should boot Tymly, but excluding the-thing-that-should-not-be plugin', async () => {
|
38 | const ts = await tymly.boot({
|
39 | pluginPaths: path.resolve(__dirname, './fixtures/plugins/*-plugin'),
|
40 | excludePlugins: 'the-thing-that-should-not-be-plugin',
|
41 | excludeBlueprints: 'the-thing-that-should-not-be-blueprint'
|
42 | })
|
43 |
|
44 | tymlyServices = ts
|
45 | statebox = ts.tymly.bootedServices.statebox
|
46 | })
|
47 |
|
48 | it('Test we\'ve got the it-lives version of the Hello state resource, because of exclusion', async () => {
|
49 | const Hello = statebox = statebox.statebox.findModuleByName('hello')
|
50 | const hello = new Hello()
|
51 | const event = {}
|
52 | const context = {
|
53 | sendTaskSuccess: function () {}
|
54 | }
|
55 | hello.run(event, context)
|
56 | expect(event.greeting).to.eql('HELLO...')
|
57 | })
|
58 |
|
59 | it('Second Tymly shutdown', async () => {
|
60 | await tymlyServices.tymly.shutdown()
|
61 | })
|
62 | })
|