Skip to content

Commit

Permalink
Enable BNA export test (hyperledger-archives#682)
Browse files Browse the repository at this point in the history
* enable export test

* remove unused async import
  • Loading branch information
nklincoln authored Apr 13, 2017
1 parent 7cf17ca commit 6dffe31
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3 *ngIf="file.readme">About</h3>
</button>
</div>
<div>
<button type="button" class="action" (click)="openExportModal()">
<button type="button" class="action" (click)="exportBNA()">
<svg class="standard-icon" aria-hidden="true">
<use xlink:href="#icon-upload_32"></use>
</svg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,8 @@ describe('EditorComponent', () => {
}));
});

//TODO: workout how to do this
xdescribe('openExportModal', () => {
it('should export file', fakeAsync(() => {
describe('exportBNA', () => {
it('should export file', (done) => {
mockClientService.getBusinessNetwork.returns({
toArchive: sinon.stub().returns(Promise.resolve('my data'))
});
Expand All @@ -471,12 +470,13 @@ describe('EditorComponent', () => {
next: sinon.stub()
};

component.openExportModal();
component.exportBNA();

tick();

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

describe('openAddFileModal', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {saveAs} from 'file-saver';
'./editor.component.scss'.toString()
]
})

export class EditorComponent implements OnInit {

private files: any = [];
Expand Down Expand Up @@ -233,7 +234,7 @@ export class EditorComponent implements OnInit {
});
}

openExportModal() {
exportBNA() {
return this.clientService.getBusinessNetwork().toArchive().then((exportedData) => {
let file = new File([exportedData],
this.clientService.getBusinessNetworkName() + '.bna',
Expand Down

0 comments on commit 6dffe31

Please sign in to comment.