From c718e8196e39b22328d26941c11310a55630867f Mon Sep 17 00:00:00 2001 From: Balthazar Gronon Date: Fri, 6 Feb 2015 18:45:17 +0100 Subject: [PATCH] test(api): add testing for api with sockets --- test/test-api.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/test/test-api.js b/test/test-api.js index e635d6e..22ec2c6 100644 --- a/test/test-api.js +++ b/test/test-api.js @@ -129,8 +129,40 @@ describe('Launching api tests', function () { [path.join(bangDir, '/app'), ], false, { 'skipInstall': true, 'skipLog': true }); - helpers.mockPrompt(bangular, { name: 'Test', backend: 'restock', modules: [] }); + helpers.mockPrompt(bangular, { name: 'Test', backend: 'mongo', modules: [], sockets: true }); + bangular.run(done); + }); + + }); + + it('should test api with sockets', function (done) { + + bangApi = helpers.createGenerator('bangular:api', [bangDir + '/api'], 'user'); + helpers.mockPrompt(bangApi, { url: '/api/users', sockets: true }); + bangApi.run(function () { + assert.file('server/api/user/index.js'); + assert.file('server/api/user/user.socket.js'); + assert.fileContent('server/config/sockets.js', 'require(\'../api/user/user.socket.js\').register(socket);'); + done(); + }); + }); + + }); + describe('', function () { + + before(function (done) { + + tmpDir = path.join(os.tmpdir(), '/tmp'); + + helpers.testDirectory(tmpDir, function (err) { + if (err) { done(err); } + + bangular = helpers.createGenerator('bangular:app', + [path.join(bangDir, '/app'), + ], false, { 'skipInstall': true, 'skipLog': true }); + + helpers.mockPrompt(bangular, { name: 'Test', backend: 'restock', modules: [] }); bangular.run(done); });