Я получаю ошибку тайм-аута в большинстве, но не всегда, когда я запускаю zapier test
независимо от того, добавляю ли я --debug
или нет, вот мой код:
require('should');
const zapier = require('zapier-platform-core');
// Use this to make test calls into your app:
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('Zapier - ON24 CLI Auth App', () => {
it('should have Access Tokens pass the authentication from ON24 APIs', (done) => {
const bundle = {
authData:{
accessTokenKey: 'abc',
accessTokenSecret: 'def',
client_id: '123'
}
};
appTester(App.authentication.test, bundle)
.then((response) => {
response.status.should.eql(200);
done();
})
.catch(done);
});
});
Ошибка:
Ошибка: превышено время ожидания 2000 мс. Для асинхронных тестов и ловушек убедитесь, что вызывается "done()"; если возвращаете обещание, убедитесь, что оно разрешается
Пытался добавить this.timeout(5000);
выше const bundle
, но это говорит о том, что timeout
не является функцией.
Обновление - тестовый модуль:
const testAuth = (z, bundle) => {
return z.request({
url: `https://wccqa.on24.com/wcc/api/v2/client/${bundle.authData.client_id}/languages`
}).then((response) => {
if(response.status === 401){
throw new Error('The API Keys provided are invalid');
}
return response;
});
};
module.exports = {
type: 'custom',
fields: [
{
key: 'accessTokenKey', label: 'Access Token Key', required: true, type: 'string'
},
{
key: 'accessTokenSecret', label: 'Access Token Secret', required: true, type: 'string'
},
{
key: 'client_id', label: 'Client Id', required: true, type: 'string'
}
],
test: testAuth,
connectionLabel: 'testAuth connectionLabel'
};
appTester(...)
. Как выглядит вашApp.authentication.test
файл/метод? - person Phix   schedule 16.12.2017