Skip to content

Commit

Permalink
stub saveAs and tidy logging (hyperledger-archives#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
nklincoln authored and Simon Stone committed May 3, 2017
1 parent d131b8b commit 93ff524
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ describe('AddCertificateComponent', () => {
// Call method
component.fileAccepted(file);
tick();
console.log('#### expand input value', component['expandInput']);

// Check
component.expandInput.should.equal(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {ModelFile, Script} from 'composer-common';
import * as sinon from 'sinon';
import * as chai from 'chai';

import * as fileSaver from 'file-saver';

let should = chai.should();


Expand Down Expand Up @@ -460,11 +462,14 @@ describe('EditorComponent', () => {

describe('exportBNA', () => {
it('should export file', (done) => {

let mockSave = sinon.stub(fileSaver, 'saveAs');

mockClientService.getBusinessNetwork.returns({
toArchive: sinon.stub().returns(Promise.resolve('my data'))
toArchive: sinon.stub().returns(Promise.resolve('my_data'))
});

mockClientService.getBusinessNetworkName.returns('my name');
mockClientService.getBusinessNetworkName.returns('my_business_name');

mockAlertService.successStatus$ = {
next: sinon.stub()
Expand All @@ -473,6 +478,7 @@ describe('EditorComponent', () => {
component.exportBNA();

fixture.whenStable().then(() => {
mockSave.should.have.been.called;
mockAlertService.successStatus$.next.should.have.been.called;
done();
});
Expand Down

0 comments on commit 93ff524

Please sign in to comment.