Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
test for #19
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 15, 2016
1 parent ee41d33 commit 2d4f339
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/samples/no-valid-keys/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import mimeDb from './mime-db.json';

assert.deepEqual( mimeDb[ 'application/1d-interleaved-parityfec' ], {
source: 'iana'
});
11 changes: 11 additions & 0 deletions test/samples/no-valid-keys/mime-db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"application/1d-interleaved-parityfec": {
"source": "iana"
},
"application/3gpdash-qoe-report+xml": {
"source": "iana"
},
"application/3gpp-ims+xml": {
"source": "iana"
}
}
13 changes: 13 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,17 @@ describe( 'rollup-plugin-json', function () {
"sourceType": "module"
});
});

it( 'handles JSON objects with no valid keys (#19)', function () {
return rollup.rollup({
entry: 'samples/no-valid-keys/main.js',
plugins: [ json() ]
}).then( function ( bundle ) {
var generated = bundle.generate();
var code = generated.code;

var fn = new Function( 'assert', code );
fn( assert );
});
});
});

0 comments on commit 2d4f339

Please sign in to comment.