|
28 | 28 | var instance;
|
29 | 29 |
|
30 | 30 | beforeEach(function() {
|
31 |
| - instance = new DeepAffects.DiarizeApi(); |
| 31 | + instance = new DeepAffects.DiarizeApiV2(); |
32 | 32 | });
|
33 | 33 |
|
34 | 34 | var getProperty = function(object, getter, property) {
|
|
47 | 47 | object[property] = value;
|
48 | 48 | }
|
49 | 49 |
|
50 |
| - describe('DiarizeApi', function() { |
| 50 | + describe('DiarizeApiV2', function() { |
51 | 51 | describe('asyncDiarizeAudio', function() {
|
52 | 52 | 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); |
69 | 75 | });
|
70 | 76 | });
|
71 | 77 | });
|
|
0 commit comments