File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,35 @@ describe('Auth Functions', () => {
175175 lastSignInTime : null ,
176176 } ,
177177 } ) ;
178+
179+ } ) ;
180+
181+ it ( 'will make lastSignInTime null if missing from metadata object (upon creation and no sign in yet)' , ( ) => {
182+ const record = auth . userRecordConstructor ( {
183+ metadata : {
184+ creationTime : '2017-02-02T23:06:26.124Z' ,
185+ }
186+ } ) ;
187+ expect ( record . toJSON ( ) ) . to . deep . equal ( {
188+ email : null ,
189+ emailVerified : false ,
190+ displayName : null ,
191+ photoURL : null ,
192+ phoneNumber : null ,
193+ disabled : false ,
194+ providerData : [ ] ,
195+ customClaims : { } ,
196+ passwordSalt : null ,
197+ passwordHash : null ,
198+ tokensValidAfterTime : null ,
199+ metadata : {
200+ creationTime : '2017-02-02T23:06:26.124Z' ,
201+ lastSignInTime : null ,
202+ } ,
203+ } ) ;
178204 } ) ;
179205
206+
180207 it ( 'will not interfere with fields that are in raw wire data' , ( ) => {
181208 const raw : any = {
182209 uid : '123' ,
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ export function userRecordConstructor(
143143 new UserRecordMetadata (
144144 // Transform payload to firebase-admin v5.0.0 format because wire format is different (BUG 63167395)
145145 meta . createdAt || meta . creationTime ,
146- meta . lastSignedInAt || meta . lastSignInTime
146+ meta . lastSignedInAt || meta . lastSignInTime || null
147147 )
148148 ) ;
149149 } else {
You can’t perform that action at this time.
0 commit comments