@@ -48,31 +48,25 @@ describe('syncUser from SBBOL', () => {
4848 expect ( checkOnboarding ) . toBeDefined ( )
4949 } )
5050 } )
51- describe ( 'user with given phone already existed' , ( ) => {
51+ describe ( 'User with given phone already existed' , ( ) => {
5252 it ( 'should update importId and importRemoteSystem fields' , async ( ) => {
53- const client = await makeClientWithRegisteredOrganization ( )
53+ const { userAttrs : { phone : existingUserPhone } , user : existingUser } = await makeClientWithRegisteredOrganization ( )
5454 const adminContext = await keystone . createContext ( { skipAccessControl : true } )
5555 const context = {
5656 keystone,
5757 context : adminContext ,
5858 }
59- const existedUser = await getItem ( {
60- keystone,
61- itemId : client . user . id ,
62- listKey : 'User' ,
63- returnFields : 'id name phone' ,
64- } )
6559 const { userData } = MockSbbolResponses . getUserAndOrganizationInfo ( )
66- userData . phone = existedUser . phone
60+ userData . phone = existingUserPhone
6761 await syncUser ( { context, userInfo : userData } )
6862 const updatedUser = await getItem ( {
6963 keystone,
70- itemId : client . user . id ,
64+ itemId : existingUser . id ,
7165 listKey : 'User' ,
7266 returnFields : 'id name phone importId importRemoteSystem' ,
7367 } )
74- expect ( existedUser . id ) . toEqual ( updatedUser . id )
75- expect ( existedUser . phone ) . toEqual ( updatedUser . phone )
68+ expect ( updatedUser . id ) . toEqual ( existingUser . id )
69+ expect ( updatedUser . phone ) . toEqual ( existingUserPhone )
7670 expect ( updatedUser . importId ) . toEqual ( userData . importId )
7771 expect ( updatedUser . importRemoteSystem ) . toEqual ( userData . importRemoteSystem )
7872 } )
@@ -114,7 +108,7 @@ describe('syncUser from SBBOL', () => {
114108 expect ( staff . importRemoteSystem ) . toEqual ( userData . importRemoteSystem )
115109 } )
116110 } )
117- describe ( 'another first user with given email already exist' , ( ) => {
111+ describe ( 'Another first user with given email already exist' , ( ) => {
118112 describe ( 'another second user with given phone does not exist' , ( ) => {
119113 it ( 'should clean email of first another user and create new user with given email and phone' , async ( ) => {
120114 const adminContext = await keystone . createContext ( { skipAccessControl : true } )
@@ -139,7 +133,7 @@ describe('syncUser from SBBOL', () => {
139133 expect ( updatedExistingUser . email ) . toBeNull ( )
140134 } )
141135 } )
142- describe ( 'another second user with given phone already exist' , ( ) => {
136+ describe ( 'Another second user with given phone already exist' , ( ) => {
143137 it ( 'should clean email of first another user and update another second user with info from SBBOL' , async ( ) => {
144138 const adminContext = await keystone . createContext ( { skipAccessControl : true } )
145139 const context = {
0 commit comments