@@ -18,11 +18,15 @@ function getTestClient(): Svix | null {
1818const client = getTestClient ( ) ;
1919
2020// Auto-skip tests in this module if we don't have a test client to work with.
21- test ( "e2e tests" , { skip : client == null } , async ( t ) => {
21+ test ( "e2e tests" , { skip : client === null } , async ( t ) => {
2222 await t . test ( "endpoint crud" , async ( ) => {
23- const appOut = await client ! . application . create ( { name : "App" } ) ;
23+ if ( client === null || client === undefined ) {
24+ throw new Error ( "unreachable" ) ;
25+ }
26+
27+ const appOut = await client . application . create ( { name : "App" } ) ;
2428 try {
25- await client ! . eventType . create ( {
29+ await client . eventType . create ( {
2630 name : "event.started" ,
2731 description : "Something started" ,
2832 } ) ;
@@ -31,7 +35,7 @@ test("e2e tests", { skip: client == null }, async (t) => {
3135 assert . deepEqual ( ( e as ApiException < HttpErrorOut > ) . code , 409 ) ;
3236 }
3337 try {
34- await client ! . eventType . create ( {
38+ await client . eventType . create ( {
3539 name : "event.ended" ,
3640 description : "Something ended" ,
3741 } ) ;
@@ -40,21 +44,21 @@ test("e2e tests", { skip: client == null }, async (t) => {
4044 assert . deepEqual ( ( e as ApiException < HttpErrorOut > ) . code , 409 ) ;
4145 }
4246
43- const epOut = await client ! . endpoint . create ( appOut ! . id ! , {
47+ const epOut = await client . endpoint . create ( appOut . id , {
4448 url : "https://example.svix.com/" ,
4549 channels : [ "ch0" , "ch1" ] ,
4650 } ) ;
47- assert . deepEqual ( epOut ! . channels ! . sort ( ) , [ "ch0" , "ch1" ] ) ;
48- assert . deepEqual ( epOut ! . filterTypes || [ ] , [ ] ) ;
51+ assert . deepEqual ( epOut . channels ? .sort ( ) , [ "ch0" , "ch1" ] ) ;
52+ assert . deepEqual ( epOut . filterTypes || [ ] , [ ] ) ;
4953
50- const epPatched = await client ! . endpoint . patch ( appOut ! . id ! , epOut ! . id ! , {
54+ const epPatched = await client . endpoint . patch ( appOut . id , epOut . id , {
5155 filterTypes : [ "event.started" , "event.ended" ] ,
5256 } ) ;
5357
54- assert . deepEqual ( epPatched ! . channels ! . sort ( ) , [ "ch0" , "ch1" ] ) ;
55- assert . deepEqual ( epPatched ! . filterTypes ! . sort ( ) , [ "event.ended" , "event.started" ] ) ;
58+ assert . deepEqual ( epPatched . channels ? .sort ( ) , [ "ch0" , "ch1" ] ) ;
59+ assert . deepEqual ( epPatched . filterTypes ? .sort ( ) , [ "event.ended" , "event.started" ] ) ;
5660
5761 // Should not throw an error while trying to deserialize the empty body.
58- await client ! . endpoint . delete ( appOut ! . id ! , epOut ! . id ! ) ;
62+ await client . endpoint . delete ( appOut . id , epOut . id ) ;
5963 } ) ;
6064} ) ;
0 commit comments