无论我添加与否,我在大多数但不是所有时间运行时都会收到超时错误,这是我的代码: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()”;如果返回一个 Promise,确保它解决
尝试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'
};