Skip to content

Commit

Permalink
added test for jso2ssff error on non SHORT cols
Browse files Browse the repository at this point in the history
  • Loading branch information
raphywink committed Oct 10, 2014
1 parent 31e8218 commit 5399362
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = function (config) {
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
browsers: ['PhantomJS', 'Chrome'],

captureTimeout: 60000,

Expand Down
29 changes: 29 additions & 0 deletions test/spec/workers/ssffParserWorker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ describe('Worker: ssffParserWorker', function () {

var worker;
var binary;
var jsoDftSpec, jsoFundFreq, jsoFORMANTS;
var workerFile = 'scripts/workers/ssffParserWorker.js';

// load the controller's module
beforeEach(module('emuwebApp'));

/**
*
*/
it('should return error on unknown parameter', function (done) {
worker = new Worker(workerFile);
worker.addEventListener('message', function (e) {
Expand All @@ -23,13 +27,17 @@ describe('Worker: ssffParserWorker', function () {
});

if (navigator.userAgent.match(/PhantomJS/i) === null) { // phantomjs no support for Float64Array =(
/**
*
*/
it('should parse Arr to ssffJsoArr', function (done) {
worker = new Worker(workerFile);
worker.addEventListener('message', function (e) {
expect(e.data.status.type).toEqual('SUCCESS');
expect(e.data.status.message).toEqual('');
expect(e.data.data.length).toEqual(3);

jsoDftSpec = e.data.data[0];
expect(e.data.data[0].ssffTrackName).toEqual('dftSpec');
expect(e.data.data[0].sampleRate).toEqual(200);
expect(e.data.data[0].startTime).toEqual(0.0025);
Expand Down Expand Up @@ -85,5 +93,26 @@ describe('Worker: ssffParserWorker', function () {
'ssffArr': buf
});
});

/**
*
*/
it('should return error while parsing non SHORT column jso to ssff', function (done) {
var worker = new Worker(workerFile);

worker.addEventListener('message', function (e) {
expect(e.data.status.type).toEqual('ERROR');

worker.terminate();
done();
})

var buf = msajc003_bndl.ssffFiles;
worker.postMessage({
'cmd': 'jso2ssff',
'jso': JSON.stringify(jsoDftSpec)
});

});
}
});

0 comments on commit 5399362

Please sign in to comment.