Created
May 16, 2023 16:40
-
-
Save ploeber/1dd535a7f7404712e8ff95cd88f4422b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals describe, it, expect */ | |
const zapier = require('zapier-platform-core'); | |
const App = require('../index'); | |
const appTester = zapier.createAppTester(App); | |
// Load .env file variables | |
zapier.tools.env.inject() | |
describe('custom auth', () => { | |
it('passes authentication and returns json', async () => { | |
const bundle = { | |
authData: { | |
apiKey: process.env.ASSEMBLYAI_KEY, | |
}, | |
}; | |
const response = await appTester(App.authentication.test, bundle); | |
expect(response.status === 200); | |
}); | |
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'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment