Skip to content

Commit

Permalink
nock segment requests
Browse files Browse the repository at this point in the history
  • Loading branch information
tcgilbert committed Nov 5, 2024
1 parent a3e30e3 commit 8e014cd
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ const createAudienceInput = {

describe('Snap Audiences', () => {
describe('createAudience', () => {
beforeEach(() => {
// Catch all Segment API requests and return 200
nock('https://api.segment.io').persist().post('/v1/track').reply(200)
})

afterEach(() => {
nock.cleanAll()
})

it('should fail if Segment audience name is available', async () => {
createAudienceInput.audienceName = ''
await expect(testDestination.createAudience(createAudienceInput)).rejects.toThrowError(IntegrationError)
Expand Down

0 comments on commit 8e014cd

Please sign in to comment.