@@ -164,8 +164,8 @@ describe('displayRevisions plugin', function() {
164
164
} ,
165
165
revisions : [
166
166
{ revision : "rev:abcdef" , timestamp : 1438232435000 , deployer : "My Hamster" } ,
167
- { revision : "rev:defghi" , timestamp : 1032123125000 , deployer : "My Hamster" , active : true } ,
168
- { revision : "rev:jklmno" , timestamp : 1032123128000 , deployer : "My Hamster" } ,
167
+ { revision : "rev:defghi" , timestamp : '2002-09-15T20:52:05.000Z' , deployer : "My Hamster" , active : true } ,
168
+ { revision : "rev:jklmno" , timestamp : new Date ( 1032123128000 ) , deployer : "My Hamster" } ,
169
169
{ revision : "rev:qrstuv" , timestamp : 1032123155000 , deployer : "My Hamster" } ,
170
170
{ revision : "rev:xyz123" , timestamp : 1032123123000 , deployer : "My Hamster" }
171
171
]
@@ -198,7 +198,7 @@ describe('displayRevisions plugin', function() {
198
198
assert . equal ( messages . length , 0 ) ;
199
199
} ) ;
200
200
201
- it ( 'transforms timestamps to human-readable dates (yyyy/MM/dd HH:mm:ss)' , function ( ) {
201
+ it ( 'transforms millisecond timestamps to human-readable dates (yyyy/MM/dd HH:mm:ss)' , function ( ) {
202
202
plugin . displayRevisions ( context ) ;
203
203
let expectedFormat = ( 'yyyy/MM/dd HH:mm:ss' ) ;
204
204
let expectedDate = DateTime . fromMillis ( 1438232435000 ) . toFormat ( expectedFormat ) ;
@@ -213,6 +213,36 @@ describe('displayRevisions plugin', function() {
213
213
assert . equal ( messages . length , 1 ) ;
214
214
} ) ;
215
215
216
+ it ( 'transforms ISO string timestamps to human-readable dates (yyyy/MM/dd HH:mm:ss)' , function ( ) {
217
+ plugin . displayRevisions ( context ) ;
218
+ let expectedFormat = ( 'yyyy/MM/dd HH:mm:ss' ) ;
219
+ let expectedDate = DateTime . fromISO ( '2002-09-15T20:52:05.000Z' ) . toFormat ( expectedFormat ) ;
220
+
221
+ let messages = mockUi . messages . reduce ( function ( previous , current ) {
222
+ if ( current . indexOf ( expectedDate ) !== - 1 ) {
223
+ previous . push ( current ) ;
224
+ }
225
+
226
+ return previous ;
227
+ } , [ ] ) ;
228
+ assert . equal ( messages . length , 1 ) ;
229
+ } ) ;
230
+
231
+ it ( 'transforms JS Date object timestamps to human-readable dates (yyyy/MM/dd HH:mm:ss)' , function ( ) {
232
+ plugin . displayRevisions ( context ) ;
233
+ let expectedFormat = ( 'yyyy/MM/dd HH:mm:ss' ) ;
234
+ let expectedDate = DateTime . fromJSDate ( new Date ( 1032123128000 ) ) . toFormat ( expectedFormat ) ;
235
+
236
+ let messages = mockUi . messages . reduce ( function ( previous , current ) {
237
+ if ( current . indexOf ( expectedDate ) !== - 1 ) {
238
+ previous . push ( current ) ;
239
+ }
240
+
241
+ return previous ;
242
+ } , [ ] ) ;
243
+ assert . equal ( messages . length , 1 ) ;
244
+ } ) ;
245
+
216
246
it ( 'highlights the active revision' , function ( ) {
217
247
plugin . displayRevisions ( context ) ;
218
248
let messages = mockUi . messages . reduce ( function ( previous , current ) {
0 commit comments