-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from droztech/feat-types
feat: tickets & users types + adjustments on types exports + option to throwOriginalException
- Loading branch information
Showing
6 changed files
with
82 additions
and
37 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import process from 'node:process'; | ||
import dotenv from 'dotenv'; | ||
import {describe, expect, it} from 'vitest'; | ||
import {initializeClient} from './setup.js'; | ||
|
||
dotenv.config(); | ||
|
||
const username = process.env.ZENDESK_USERNAME; | ||
const token = process.env.ZENDESK_TOKEN; | ||
|
||
describe('Zendesk Exceptions Handling', () => { | ||
it('should throw an error for an invalid subdomain', async () => { | ||
const error = new Error('My Custom Error'); | ||
error.details = 'Custom Details'; | ||
|
||
const client = initializeClient({ | ||
username, | ||
token, | ||
subdomain: 'any', | ||
throwOriginalException: true, | ||
transportConfig: { | ||
transportFn() { | ||
throw error; | ||
}, | ||
}, | ||
}); | ||
|
||
await expect(() => client.users.me()).rejects.toThrowError(error); | ||
}); | ||
}); |