@@ -3,15 +3,15 @@ import { describe, expect, test } from 'vitest';
33
44import { PlainClient } from '..' ;
55import type { PlainSDKError } from '../error' ;
6- import { CustomerByIdDocument } from '../graphql/types' ;
6+ import { CustomerByIdDocument , type CustomerPartsFragment } from '../graphql/types' ;
77import { PlainGraphQLError } from '../graphql-utlities' ;
88import { testHelpers } from './test-helpers' ;
99
1010describe ( 'query test - customer by id' , ( ) => {
1111 test ( 'should return a valid customer' , async ( ) => {
1212 const customerId = 'c_123' ;
1313
14- const response = {
14+ const response : { data : { customer : CustomerPartsFragment } } = {
1515 data : {
1616 customer : {
1717 __typename : 'Customer' ,
@@ -22,17 +22,27 @@ describe('query test - customer by id', () => {
2222 email : {
2323 email : 'test@gmail.com' ,
2424 isVerified : true ,
25- verifiedAt : { __typename : 'DateTime' , iso8601 : '2023-03-20T13:06:37.918Z' } ,
25+ verifiedAt : {
26+ __typename : 'DateTime' ,
27+ iso8601 : '2023-03-20T13:06:37.918Z' ,
28+ unixTimestamp : '1699890305' ,
29+ } ,
30+ } ,
31+ updatedAt : {
32+ __typename : 'DateTime' ,
33+ iso8601 : '2023-05-01T09:54:51.715Z' ,
34+ unixTimestamp : '1699890305' ,
35+ } ,
36+ createdAt : {
37+ __typename : 'DateTime' ,
38+ iso8601 : '2023-03-20T13:06:37.961Z' ,
39+ unixTimestamp : '1699890305' ,
2640 } ,
27- status : 'ACTIVE' ,
28- statusChangedAt : { __typename : 'DateTime' , iso8601 : '2023-05-01T09:54:51.715Z' } ,
29- assignedToUser : { __typename : 'UserActor' , userId : 'u_123' } ,
30- assignedAt : { __typename : 'DateTime' , iso8601 : '2023-04-10T15:01:54.499Z' } ,
31- updatedAt : { __typename : 'DateTime' , iso8601 : '2023-05-01T09:54:51.715Z' } ,
32- lastIdleAt : { __typename : 'DateTime' , iso8601 : '2023-03-20T13:06:47.492Z' } ,
33- createdAt : { __typename : 'DateTime' , iso8601 : '2023-03-20T13:06:37.961Z' } ,
3441 createdBy : { } ,
3542 markedAsSpamAt : null ,
43+ customerGroupMemberships : {
44+ edges : [ ] ,
45+ } ,
3646 } ,
3747 } ,
3848 } ;
@@ -56,7 +66,10 @@ describe('query test - customer by id', () => {
5666 } ) ;
5767
5868 expect ( result . error ) . toBeUndefined ( ) ;
59- expect ( result . data ) . toEqual ( response . data . customer ) ;
69+ expect ( result . data ) . toEqual ( {
70+ ...response . data . customer ,
71+ customerGroupMemberships : [ ] ,
72+ } ) ;
6073 } ) ;
6174
6275 test ( 'should accept a null customer when not found' , async ( ) => {
0 commit comments