-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
"version": "1.0.0", | ||
"description": "Converts an audio file to LINEAR16 Google-speech compatible file.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha -c -R spec" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://[email protected]:bouiboui/linear16.git" | ||
|
@@ -23,5 +26,8 @@ | |
"dependencies": { | ||
"fluent-ffmpeg": "^2.1.0", | ||
"mime": "^1.3.4" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const linear16 = require('../index'); | ||
const describe = require('mocha').describe; | ||
const it = require('mocha').it; | ||
const fs = require('fs'); | ||
|
||
describe('linear16', () => { | ||
it('should fail if parameters are missing', () => { | ||
linear16().then(() => { | ||
throw new Error('should have rejected input'); | ||
}).catch(err => { | ||
}); | ||
linear16('./test').then(() => { | ||
throw new Error('should have rejected input'); | ||
}).catch(err => { | ||
}); | ||
linear16(null, './test').then(() => { | ||
throw new Error('should have rejected input'); | ||
}).catch(err => { | ||
}); | ||
}); | ||
it('should fail for non-existing input file', () => { | ||
linear16('./thisfiledoesnotexist', './out') | ||
.then(() => { | ||
throw new Error('Should have thrown an error'); | ||
}) | ||
.catch(() => { | ||
}); | ||
}); | ||
it('should work normally', () => | ||
linear16( | ||
'./test/test.m4a', | ||
'./test/test.wav' | ||
).then(outFile => { | ||
assert.deepEqual(true, fs.existsSync(outFile)); | ||
fs.unlinkSync(outFile) | ||
})) | ||
}); |
Binary file not shown.