File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,29 @@ describe('Entry', function() {
6767 assert . strictEqual ( entry . metadata . timestamp , timestamp ) ;
6868 } ) ;
6969
70+ it ( 'should assign insertId to metadata' , function ( ) {
71+ assert ( typeof entry . metadata . insertId === 'string' ) ;
72+ } ) ;
73+
74+ it ( 'should generate monotonically increasing insertIds' , function ( ) {
75+ var entries = Array ( 256 ) . fill ( { } ) . map ( ( ) => { return new Entry ( ) ; } ) ;
76+ entries . reduce ( ( prev , entry ) => {
77+ assert ( typeof entry . metadata . insertId === 'string' ) ;
78+ assert ( entry . metadata . insertId > prev ) ;
79+ return entry . metadata . insertId ;
80+ } , '' ) ;
81+ } ) ;
82+
83+ it ( 'should not assign insertId if one is already set' , function ( ) {
84+ var insertId = 'fake-insert-id' ;
85+
86+ var entry = new Entry ( {
87+ insertId : insertId
88+ } ) ;
89+
90+ assert . strictEqual ( entry . metadata . insertId , insertId ) ;
91+ } ) ;
92+
7093 it ( 'should localize data' , function ( ) {
7194 assert . strictEqual ( entry . data , DATA ) ;
7295 } ) ;
You can’t perform that action at this time.
0 commit comments