Fix tests
This commit is contained in:
@@ -44,7 +44,6 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
let showTextDocumentSpy: sinon.SinonSpy;
|
||||
let openTextDocumentSpy: sinon.SinonSpy;
|
||||
|
||||
let openRemoteQueryResultsStub: sinon.SinonStub;
|
||||
let rehydrateVariantAnalysisStub: sinon.SinonStub;
|
||||
let removeVariantAnalysisStub: sinon.SinonStub;
|
||||
let showViewStub: sinon.SinonStub;
|
||||
@@ -66,14 +65,14 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
|
||||
rehydrateVariantAnalysisStub = sandbox.stub();
|
||||
removeVariantAnalysisStub = sandbox.stub();
|
||||
openRemoteQueryResultsStub = sandbox.stub();
|
||||
showViewStub = sandbox.stub();
|
||||
|
||||
remoteQueriesManagerStub = {
|
||||
onRemoteQueryAdded: sandbox.stub(),
|
||||
onRemoteQueryRemoved: sandbox.stub(),
|
||||
onRemoteQueryStatusUpdate: sandbox.stub(),
|
||||
rehydrateRemoteQuery: sandbox.stub(),
|
||||
openRemoteQueryResults: openRemoteQueryResultsStub
|
||||
openRemoteQueryResults: sandbox.stub()
|
||||
} as any as RemoteQueriesManager;
|
||||
|
||||
variantAnalysisManagerStub = {
|
||||
@@ -137,7 +136,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
// Remove the first variant analysis
|
||||
await qhm.handleRemoveHistoryItem(qhm.treeDataProvider.allHistory[0]);
|
||||
|
||||
expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
|
||||
expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis);
|
||||
expect(rehydrateVariantAnalysisStub).to.have.callCount(2);
|
||||
|
||||
expect(rehydrateVariantAnalysisStub.getCall(0).args[0]).to.deep.eq(rawQueryHistory[0].variantAnalysis);
|
||||
@@ -146,7 +145,6 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
expect(rehydrateVariantAnalysisStub.getCall(1).args[0]).to.deep.eq(rawQueryHistory[1].variantAnalysis);
|
||||
expect(rehydrateVariantAnalysisStub.getCall(1).args[1]).to.deep.eq(rawQueryHistory[1].status);
|
||||
|
||||
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[1].variantAnalysis.id.toString());
|
||||
expect(qhm.treeDataProvider.allHistory).to.deep.eq(rawQueryHistory.slice(1));
|
||||
|
||||
// Add it back to the history
|
||||
@@ -164,8 +162,8 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
await qhm.handleRemoveHistoryItem(undefined!, [qhm.treeDataProvider.allHistory[1], qhm.treeDataProvider.allHistory[0]]);
|
||||
|
||||
expect(removeVariantAnalysisStub.callCount).to.eq(2);
|
||||
expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].variantAnalysis);
|
||||
expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].variantAnalysis);
|
||||
expect(removeVariantAnalysisStub.getCall(0).args[0]).to.deep.eq(rawQueryHistory[1].variantAnalysis);
|
||||
expect(removeVariantAnalysisStub.getCall(1).args[0]).to.deep.eq(rawQueryHistory[0].variantAnalysis);
|
||||
expect(qhm.treeDataProvider.allHistory).to.deep.eq([]);
|
||||
|
||||
// also, both queries should be removed from disk storage
|
||||
@@ -179,7 +177,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
|
||||
await qhm.readQueryHistory();
|
||||
|
||||
await qhm.handleItemClicked(qhm.treeDataProvider.allHistory[0], []);
|
||||
expect(showViewStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
|
||||
expect(showViewStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id);
|
||||
});
|
||||
|
||||
it('should get the query text', async () => {
|
||||
|
||||
Reference in New Issue
Block a user