Skip to content

Commit

Permalink
test(api): add testing for api with sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
balthazar committed Feb 6, 2015
1 parent d4cbd5e commit c718e81
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion test/test-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit c718e81

Please sign in to comment.