Skip to content

Commit d0a721a

Browse files
committed
Add test for diarize api
1 parent 803b96b commit d0a721a

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

test/api/DenoiseApi.spec.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,14 @@
6464
describe('syncDenoiseAudio', function() {
6565
it('should call syncDenoiseAudio successfully', function(done) {
6666
this.timeout(0);
67-
//uncomment below and update the code to test syncDenoiseAudio
68-
//instance.syncDenoiseAudio(function(error) {
69-
// if (error) throw error;
70-
//expect().to.be();
71-
//});
7267
var defaultClient = DeepAffects.ApiClient.instance;
7368

7469
// Configure API key authorization: UserSecurity
7570
var UserSecurity = defaultClient.authentications['UserSecurity'];
7671
UserSecurity.apiKey = process.env.API_KEY;
77-
78-
7972
var api = new DeepAffects.DenoiseApi();
8073
var audioFile = path.join(__dirname, '..', 'data', 'clean.wav');
8174
var instance = DeepAffects.Audio.fromFile(audioFile);
82-
console.log(instance);
8375
var callback = function(error, data, response) {
8476
if (error) {
8577
console.error(error);

test/api/DiarizeApi.spec.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
var instance;
2929

3030
beforeEach(function() {
31-
instance = new DeepAffects.DiarizeApi();
31+
instance = new DeepAffects.DiarizeApiV2();
3232
});
3333

3434
var getProperty = function(object, getter, property) {
@@ -47,25 +47,31 @@
4747
object[property] = value;
4848
}
4949

50-
describe('DiarizeApi', function() {
50+
describe('DiarizeApiV2', function() {
5151
describe('asyncDiarizeAudio', function() {
5252
it('should call asyncDiarizeAudio successfully', function(done) {
53-
//uncomment below and update the code to test asyncDiarizeAudio
54-
//instance.asyncDiarizeAudio(function(error) {
55-
// if (error) throw error;
56-
//expect().to.be();
57-
//});
58-
done();
59-
});
60-
});
61-
describe('syncDiarizeAudio', function() {
62-
it('should call syncDiarizeAudio successfully', function(done) {
63-
//uncomment below and update the code to test syncDiarizeAudio
64-
//instance.syncDiarizeAudio(function(error) {
65-
// if (error) throw error;
66-
//expect().to.be();
67-
//});
68-
done();
53+
this.timeout(0);
54+
var defaultClient = DeepAffects.ApiClient.instance;
55+
56+
// Configure API key authorization: UserSecurity
57+
var UserSecurity = defaultClient.authentications['UserSecurity'];
58+
UserSecurity.apiKey = process.env.API_KEY;
59+
60+
61+
var api = new DeepAffects.DiarizeApiV2();
62+
var audioFile = path.join(__dirname, '..', 'data', 'cnndebate.wav');
63+
var instance = DeepAffects.DiarizeAudio.fromFile(audioFile);
64+
var webhook = "http://your/webhook/"
65+
var callback = function(error, data, response) {
66+
if (error) {
67+
console.error(error);
68+
} else {
69+
console.log('API called successfully. Returned data: ' + data);
70+
}
71+
expect(data).to.be.a(DeepAffects.AsyncResponse);
72+
};
73+
74+
api.asyncDiarizeAudio(instance, webhook, callback);
6975
});
7076
});
7177
});

test/data/cnndebate.wav

7.53 MB
Binary file not shown.

0 commit comments

Comments
 (0)