@@ -64,7 +64,7 @@ describe('RemoteConfig', () => {
64646565 } ,
6666 description : 'production version' ,
67- updateTime : '2020-06-15T16:45:03.000Z '
67+ updateTime : '2020-06-15T16:45:03.541527Z '
6868 } ;
6969
7070 const REMOTE_CONFIG_RESPONSE : {
@@ -123,7 +123,7 @@ describe('RemoteConfig', () => {
123123 versions : [
124124 {
125125 versionNumber : '78' ,
126- updateTime : '2020-05-07T18:46:09.495Z ' ,
126+ updateTime : '2020-05-07T18:46:09.495234Z ' ,
127127 updateUser : {
128128129129 imageUrl : 'https://photo.jpg'
@@ -680,5 +680,57 @@ describe('RemoteConfig', () => {
680680 expect ( parsed ) . deep . equals ( expectedTemplate ) ;
681681 } ) ;
682682 } ) ;
683+
684+ it ( 'should resolve with template when Version updateTime contains only 3 ms places' , ( ) => {
685+ const response = deepCopy ( REMOTE_CONFIG_RESPONSE ) ;
686+ const versionInfo = deepCopy ( VERSION_INFO ) ;
687+ versionInfo . updateTime = '2020-11-03T20:24:15.203Z' ;
688+ response . version = versionInfo ;
689+ const stub = sinon
690+ . stub ( RemoteConfigApiClient . prototype , operationName )
691+ . resolves ( response ) ;
692+ stubs . push ( stub ) ;
693+
694+ return rcOperation ( )
695+ . then ( ( template ) => {
696+ expect ( template . etag ) . to . equal ( 'etag-123456789012-5' ) ;
697+
698+ const version = template . version ! ;
699+ expect ( version . versionNumber ) . to . equal ( '86' ) ;
700+ expect ( version . updateOrigin ) . to . equal ( 'ADMIN_SDK_NODE' ) ;
701+ expect ( version . updateType ) . to . equal ( 'INCREMENTAL_UPDATE' ) ;
702+ expect ( version . updateUser ) . to . deep . equal ( {
703+ 704+ } ) ;
705+ expect ( version . description ) . to . equal ( 'production version' ) ;
706+ expect ( version . updateTime ) . to . equal ( 'Tue, 03 Nov 2020 20:24:15 GMT' ) ;
707+ } ) ;
708+ } ) ;
709+
710+ it ( 'should resolve with template when Version updateTime contains 6 ms places' , ( ) => {
711+ const response = deepCopy ( REMOTE_CONFIG_RESPONSE ) ;
712+ const versionInfo = deepCopy ( VERSION_INFO ) ;
713+ versionInfo . updateTime = '2020-11-13T17:01:36.541527Z' ;
714+ response . version = versionInfo ;
715+ const stub = sinon
716+ . stub ( RemoteConfigApiClient . prototype , operationName )
717+ . resolves ( response ) ;
718+ stubs . push ( stub ) ;
719+
720+ return rcOperation ( )
721+ . then ( ( template ) => {
722+ expect ( template . etag ) . to . equal ( 'etag-123456789012-5' ) ;
723+
724+ const version = template . version ! ;
725+ expect ( version . versionNumber ) . to . equal ( '86' ) ;
726+ expect ( version . updateOrigin ) . to . equal ( 'ADMIN_SDK_NODE' ) ;
727+ expect ( version . updateType ) . to . equal ( 'INCREMENTAL_UPDATE' ) ;
728+ expect ( version . updateUser ) . to . deep . equal ( {
729+ 730+ } ) ;
731+ expect ( version . description ) . to . equal ( 'production version' ) ;
732+ expect ( version . updateTime ) . to . equal ( 'Fri, 13 Nov 2020 17:01:36 GMT' ) ;
733+ } ) ;
734+ } ) ;
683735 }
684736} ) ;
0 commit comments