@@ -465,4 +465,71 @@ describe('api.client', () => {
465465 expect ( response . id ) . toBe ( 'mt_test' ) ;
466466 } ) ;
467467 } ) ;
468+
469+ describe ( 'WaitlistEntry' , ( ) => {
470+ it ( 'executes a successful backend API request to bulk create waitlist entries' , async ( ) => {
471+ const emailAddresses = [ 'foo@bar.com' , 'bar@foo.com' ] ;
472+ const ids = [ 'wle_123' , 'wle_456' ] ;
473+ const createdAt = 1700000000 ;
474+ const updatedAt = 1700000100 ;
475+
476+ server . use (
477+ http . post (
478+ `https://api.clerk.test/v1/waitlist_entries/bulk` ,
479+ validateHeaders ( async ( { request } ) => {
480+ const body = await request . json ( ) ;
481+ expect ( body ) . toEqual ( [
482+ { email_address : emailAddresses [ 0 ] } ,
483+ { email_address : emailAddresses [ 1 ] , notify : true } ,
484+ ] ) ;
485+
486+ return HttpResponse . json ( [
487+ {
488+ object : 'waitlist_entry' ,
489+ id : ids [ 0 ] ,
490+ email_address : emailAddresses [ 0 ] ,
491+ status : 'pending' ,
492+ is_locked : false ,
493+ created_at : createdAt ,
494+ updated_at : updatedAt ,
495+ invitation : null ,
496+ } ,
497+ {
498+ object : 'waitlist_entry' ,
499+ id : ids [ 1 ] ,
500+ email_address : emailAddresses [ 1 ] ,
501+ status : 'pending' ,
502+ is_locked : false ,
503+ created_at : createdAt ,
504+ updated_at : updatedAt ,
505+ invitation : null ,
506+ } ,
507+ ] ) ;
508+ } ) ,
509+ ) ,
510+ ) ;
511+
512+ const response = await apiClient . waitlistEntries . createBulk ( [
513+ { emailAddress : emailAddresses [ 0 ] } ,
514+ { emailAddress : emailAddresses [ 1 ] , notify : true } ,
515+ ] ) ;
516+
517+ expect ( response ) . toHaveLength ( 2 ) ;
518+ expect ( response [ 0 ] . id ) . toBe ( ids [ 0 ] ) ;
519+ expect ( response [ 0 ] . emailAddress ) . toBe ( emailAddresses [ 0 ] ) ;
520+ expect ( response [ 0 ] . status ) . toBe ( 'pending' ) ;
521+ expect ( response [ 0 ] . isLocked ) . toBe ( false ) ;
522+ expect ( response [ 0 ] . createdAt ) . toBe ( createdAt ) ;
523+ expect ( response [ 0 ] . updatedAt ) . toBe ( updatedAt ) ;
524+ expect ( response [ 0 ] . invitation ) . toBe ( null ) ;
525+
526+ expect ( response [ 1 ] . id ) . toBe ( ids [ 1 ] ) ;
527+ expect ( response [ 1 ] . emailAddress ) . toBe ( emailAddresses [ 1 ] ) ;
528+ expect ( response [ 1 ] . status ) . toBe ( 'pending' ) ;
529+ expect ( response [ 1 ] . isLocked ) . toBe ( false ) ;
530+ expect ( response [ 1 ] . createdAt ) . toBe ( createdAt ) ;
531+ expect ( response [ 1 ] . updatedAt ) . toBe ( updatedAt ) ;
532+ expect ( response [ 1 ] . invitation ) . toBe ( null ) ;
533+ } ) ;
534+ } ) ;
468535} ) ;
0 commit comments