Skip to content

Commit

Permalink
Add test for CRAM renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 9, 2018
1 parent 217fce2 commit 7b363bb
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/js_tests/main.js
Expand Up @@ -24,6 +24,7 @@ cjsRequire('./spec/FeatureLayout.spec.js')
cjsRequire('./spec/BigWig.spec.js')
cjsRequire('./spec/ConfigManager.spec.js')
cjsRequire('./spec/BAM.spec.js')
cjsRequire('./spec/CRAM.spec.js')
cjsRequire('./spec/Util.spec.js')
cjsRequire('./spec/AddFiles.spec.js')
cjsRequire('./spec/GBrowseParser.spec.js')
Expand Down
92 changes: 92 additions & 0 deletions tests/js_tests/spec/CRAM.spec.js
@@ -0,0 +1,92 @@
/* global dojo */
require([
'dojo/aspect',
'dojo/_base/declare',
'dojo/_base/array',
'JBrowse/Browser',
'JBrowse/FeatureFiltererMixin',
'JBrowse/Store/SeqFeature/CRAM',
'JBrowse/Model/XHRBlob',
],
function(
aspect,
declare,
array,
Browser,
FeatureFiltererMixin,
CRAMStore,
XHRBlob,
) {



describe( 'CRAM with volvox-sorted.cram', function() {
var b;
beforeEach( function() {
var browser = new Browser({ unitTestMode: true, stores: {} })
b = new CRAMStore({
browser: browser,
cram: new XHRBlob('../../sample_data/raw/volvox/volvox-sorted.cram'),
crai: new XHRBlob('../../sample_data/raw/volvox/volvox-sorted.cram.crai'),
refSeq: { name: 'ctgA', start: 1, end: 500001 }
});
});

it( 'constructs', function() {
expect(b).toBeTruthy();
});

it( 'loads some data contigA', function() {
var loaded;
var features = [];
var done;
aspect.after( b, 'loadSuccess', function() {
loaded = true;
});
b.getFeatures({ start: 0, end: 50000, name: 'contigA' },
function( feature ) {
features.push( feature );
},
function() {
done = true;
},
function(e) {
console.error(e)
}
);
waitsFor( function() { return done; }, 2000 );
runs( function() {
expect(features.length).toBeGreaterThan(1000);
});
});


it( 'loads some data ctgA', function() {
var loaded;
var features = [];
var done;
aspect.after( b, 'loadSuccess', function() {
loaded = true;
});
b.getFeatures({ start: 0, end: 50000, name: 'ctgA' },
function( feature ) {
features.push( feature );
},
function() {
done = true;
},
function(e) {
console.error(e)
}
);
waitsFor( function() { return done; }, 2000 );
runs( function() {
expect(features.length).toBeGreaterThan(1000);
});
});

});


});

0 comments on commit 7b363bb

Please sign in to comment.