1

追加するかどうかに関係なく、すべてではありませんが、ほとんどの場合にタイムアウトエラーが発生します。これが私のコードです。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'
};
4

2 に答える 2