Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
35 lines
843 B
JavaScript
35 lines
843 B
JavaScript
/* globals describe, it, expect */
|
|
|
|
const zapier = require('zapier-platform-core');
|
|
|
|
const App = require('../index');
|
|
const appTester = zapier.createAppTester(App);
|
|
|
|
describe('custom auth', () => {
|
|
it('passes authentication and returns json', async () => {
|
|
const bundle = {
|
|
authData: {
|
|
apiKey: 'secret',
|
|
},
|
|
};
|
|
|
|
const response = await appTester(App.authentication.test, bundle);
|
|
expect(response.data).toHaveProperty('username');
|
|
});
|
|
|
|
it('fails on bad auth', async () => {
|
|
const bundle = {
|
|
authData: {
|
|
apiKey: 'bad',
|
|
},
|
|
};
|
|
|
|
try {
|
|
await appTester(App.authentication.test, bundle);
|
|
} catch (error) {
|
|
expect(error.message).toContain('The API Key you supplied is incorrect');
|
|
return;
|
|
}
|
|
throw new Error('appTester should have thrown');
|
|
});
|
|
});
|