@@ -197,6 +197,36 @@ describe('checkAboutCodeDB', () => {
197197 . then ( ( ) => aboutCodeDB . db . Url . count ( ) )
198198 . then ( ( urlCount ) => assert . strictEqual ( urlCount , 30 ) ) ;
199199 } ) ;
200+ it ( 'should get header information from a legacy scan file' , ( ) => {
201+ const test_file = __dirname + '/data/aboutcodeDB/legacy-header.json' ;
202+ const aboutCodeDB = new AboutCodeDB ( ) ;
203+
204+ return aboutCodeDB . sync
205+ . then ( ( ) => aboutCodeDB . db . File . count ( ) )
206+ . then ( ( rowCount ) => assert . strictEqual ( rowCount , 0 ) )
207+ . then ( ( ) => aboutCodeDB . addFromJson ( test_file ) )
208+ . then ( ( ) => aboutCodeDB . db . Header . findOne ( { where : { id : 1 } } ) )
209+ . then ( ( header ) => {
210+ assert . strictEqual ( header . scancode_version , '2.9.2' ) ;
211+ assert . isNotNull ( header . scancode_notice ) ;
212+ assert . isNotNull ( header . scancode_options ) ;
213+ } ) ;
214+ } ) ;
215+ it ( 'should get header information from a v2.9.8 scan file' , ( ) => {
216+ const test_file = __dirname + '/data/aboutcodeDB/2.9.8-header.json' ;
217+ const aboutCodeDB = new AboutCodeDB ( ) ;
218+
219+ return aboutCodeDB . sync
220+ . then ( ( ) => aboutCodeDB . db . File . count ( ) )
221+ . then ( ( rowCount ) => assert . strictEqual ( rowCount , 0 ) )
222+ . then ( ( ) => aboutCodeDB . addFromJson ( test_file ) )
223+ . then ( ( ) => aboutCodeDB . db . Header . findOne ( { where : { id : 1 } } ) )
224+ . then ( ( header ) => {
225+ assert . strictEqual ( header . scancode_version , '2.9.8' ) ;
226+ assert . isNotNull ( header . scancode_notice ) ;
227+ assert . isNotNull ( header . scancode_options ) ;
228+ } ) ;
229+ } ) ;
200230 } ) ;
201231
202232 describe ( 'getDuplicatePaths' , ( ) => {
0 commit comments