diff --git a/js/src/enemyService.test.js b/js/src/enemyService.test.js new file mode 100644 index 0000000..d5a70a5 --- /dev/null +++ b/js/src/enemyService.test.js @@ -0,0 +1,15 @@ +const underTest = require('./enemyService.js') +var enemyManager = require('./enemyManager.js') +var playerModule = require('./player.js') +var enemyDrawer = require('./enemyDrawer.js') +var collisionDetectionModule = require('./collisionDetection.js') + +jest.mock('./enemyManager.js') +jest.mock('./player.js') +jest.mock('./enemyDrawer.js') +jest.mock('./collisionDetection.js') + +test('addEnemy calls the enemyManager addEnemy function', () => { + underTest.addEnemy(1, 2) + expect(enemyManager.addEnemy).toHaveBeenCalledWith(1, 2) +}) diff --git a/package.json b/package.json index f7c2a76..4575898 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,9 @@ "prebundle": "eslint .", "bundleNoLint": "browserify js/src/main.js -o js/src/bundle.js", "test": "jest" + }, + "jest":{ + "verbose": true, + "testURL": "http://localhost/" } }