@@ -44,6 +44,23 @@ describe('Contacts', () => {
4444 } ) ;
4545 } ) ;
4646
47+ it ( 'should pass an indexed metadata filter to the API' , async ( ) => {
48+ await contacts . list ( {
49+ identifier : 'id123' ,
50+ queryParams : {
51+ metadataPair : { key1 : 'sync_eligible' } ,
52+ } ,
53+ } ) ;
54+
55+ expect ( apiClient . request ) . toHaveBeenCalledWith ( {
56+ method : 'GET' ,
57+ path : '/v3/grants/id123/contacts' ,
58+ queryParams : {
59+ metadataPair : { key1 : 'sync_eligible' } ,
60+ } ,
61+ } ) ;
62+ } ) ;
63+
4764 it ( 'should paginate correctly if a nextCursor is present' , async ( ) => {
4865 apiClient . request . mockResolvedValueOnce ( {
4966 requestId : 'request123' ,
@@ -199,6 +216,7 @@ describe('Contacts', () => {
199216 } ,
200217 ] ,
201218 givenName : 'Test' ,
219+ metadata : { key1 : 'sync_eligible' } ,
202220 } ,
203221 overrides : {
204222 apiUri : 'https://test.api.nylas.com' ,
@@ -220,6 +238,7 @@ describe('Contacts', () => {
220238 } ,
221239 ] ,
222240 givenName : 'Test' ,
241+ metadata : { key1 : 'sync_eligible' } ,
223242 } ,
224243 overrides : {
225244 apiUri : 'https://test.api.nylas.com' ,
@@ -236,6 +255,7 @@ describe('Contacts', () => {
236255 contactId : 'contact123' ,
237256 requestBody : {
238257 birthday : '1960-12-31' ,
258+ metadata : { } ,
239259 } ,
240260 overrides : {
241261 apiUri : 'https://test.api.nylas.com' ,
@@ -248,6 +268,7 @@ describe('Contacts', () => {
248268 path : '/v3/grants/id123/contacts/contact123' ,
249269 body : {
250270 birthday : '1960-12-31' ,
271+ metadata : { } ,
251272 } ,
252273 overrides : {
253274 apiUri : 'https://test.api.nylas.com' ,
0 commit comments