-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.js
63 lines (52 loc) · 1.41 KB
/
tests.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
62
63
import 'mocha/mocha.js'
import { assert } from 'chai'
import Phaser from 'phaser'
import DisplayListWatcher from './src/main'
const { mocha, Mocha } = window
mocha.setup('bdd')
const { describe: context, test, before, after, beforeEach, afterEach } = Mocha
context('Phaser', () => {
test('is an object', () => {
assert.isObject(Phaser)
})
test('is the required version', () => {
assert.propertyVal(Phaser, 'VERSION', '3.87')
})
})
context('DisplayListWatcher', () => {
test('is a function', () => {
assert.isFunction(DisplayListWatcher)
})
})
for (const config of [{ type: Phaser.CANVAS }, { type: Phaser.WEBGL }]) {
context(`Add the plugin to the game (${JSON.stringify(config)})`, () => {
let game
test('With `plugins.scene`, the plugin class is in the plugin manager', (done) => {
game = new Phaser.Game({
...config,
plugins: {
scene: [
{
key: 'DisplayListWatcher',
plugin: DisplayListWatcher,
start: true
}
]
},
callbacks: {
preBoot: (game) => {
console.debug('preBoot')
},
postBoot: (game) => {
console.debug('postBoot')
assert.include(game.plugins.scenePlugins, 'DisplayListWatcher')
done()
}
}
})
})
})
}
mocha.checkLeaks()
mocha.globals(['Phaser'])
mocha.run()