From 467436045093d7ac0cc125b4b444240ee44885d2 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Sun, 26 Nov 2017 11:36:15 -0500 Subject: [PATCH] test: Add test for first-run compile of static resources --- test/unit/server.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/unit/server.spec.js b/test/unit/server.spec.js index 248ad1f4b..83d03314a 100644 --- a/test/unit/server.spec.js +++ b/test/unit/server.spec.js @@ -1,5 +1,7 @@ import Server from '../../lib/server' import BrowserCollection from '../../lib/browser_collection' +import * as fs from 'fs' +import * as path from 'path' describe('server', () => { var mockConfig @@ -103,6 +105,17 @@ describe('server', () => { // server._start() // ============================================================================ describe('_start', () => { + it('should compile static resources on first run', function (done) { + this.timeout(5000) + server._start(mockConfig, mockLauncher, null, mockFileList, browserCollection, mockExecutor, doneSpy) + fileListOnResolve() + + setTimeout(() => { + expect(fs.existsSync(path.join(__dirname, '/../../static/karma.js')) && fs.existsSync(path.join(__dirname, '/../../static/context.js'))).to.be.true + done() + }, 4000) + }) + it('should start the web server after all files have been preprocessed successfully', () => { server._start(mockConfig, mockLauncher, null, mockFileList, browserCollection, mockExecutor, doneSpy)