File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import process from 'node:process' ;
2
+ import dotenv from 'dotenv' ;
3
+ import { describe , expect , it } from 'vitest' ;
4
+ import { initializeClient } from './setup.js' ;
5
+
6
+ dotenv . config ( ) ;
7
+
8
+ const username = process . env . ZENDESK_USERNAME ;
9
+ const token = process . env . ZENDESK_TOKEN ;
10
+
11
+ describe ( 'Zendesk Exceptions Handling' , ( ) => {
12
+ it ( 'should throw an error for an invalid subdomain' , async ( ) => {
13
+ const error = new Error ( 'My Custom Error' ) ;
14
+ error . details = 'Custom Details' ;
15
+
16
+ const client = initializeClient ( {
17
+ username,
18
+ token,
19
+ subdomain : 'any' ,
20
+ throwOriginalException : true ,
21
+ transportConfig : {
22
+ transportFn ( ) {
23
+ throw error ;
24
+ } ,
25
+ } ,
26
+ } ) ;
27
+
28
+ await expect ( ( ) => client . users . me ( ) ) . rejects . toThrowError ( error ) ;
29
+ } ) ;
30
+ } ) ;
You can’t perform that action at this time.
0 commit comments