Skip to content

Commit

Permalink
Update what happens after transaction submitted (hyperledger-archives…
Browse files Browse the repository at this point in the history
…#2289)

Updated to not change to the historian after a transaction is submitted

contributes to hyperledger/composer#2129
  • Loading branch information
cazfletch authored Oct 5, 2017
1 parent 50cee20 commit e00c03a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
35 changes: 2 additions & 33 deletions packages/composer-playground/src/app/test/test.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,11 @@ describe('TestComponent', () => {
mockAlertService.successStatus$ = {next: sinon.stub()};
mockModal.open.returns({result: Promise.resolve(mockTransaction)});

component['chosenRegistry'] = 'assetRegistry';
component['registries']['historian'] = 'historianRegistry';

component.submitTransaction();

tick();

component['chosenRegistry'].should.equal('historianRegistry');
component['registryReload'].should.equal(false);
component['registryReload'].should.equal(true);

mockAlertService.successStatus$.next.should.have.been.calledWith({
title: 'Submit Transaction Successful',
Expand All @@ -323,15 +319,11 @@ describe('TestComponent', () => {
mockAlertService.successStatus$ = {next: sinon.stub()};
mockModal.open.returns({result: Promise.resolve(mockTransaction)});

component['chosenRegistry'] = 'assetRegistry';
component['registries']['historian'] = 'historianRegistry';

component.submitTransaction();

tick();

component['chosenRegistry'].should.equal('historianRegistry');
component['registryReload'].should.equal(false);
component['registryReload'].should.equal(true);

mockAlertService.successStatus$.next.should.have.been.calledWith({
title: 'Submit Transaction Successful',
Expand All @@ -341,29 +333,6 @@ describe('TestComponent', () => {
linkCallback: sinon.match.func
});
}));

it('should update historian registry view', fakeAsync(() => {
mockAlertService.successStatus$ = {next: sinon.stub()};
mockModal.open.returns({result: Promise.resolve(mockTransaction)});

component['registries']['historian'] = 'historianRegistry';
component['chosenRegistry'] = 'historianRegistry';

component.submitTransaction();

tick();

component['chosenRegistry'].should.equal('historianRegistry');
component['registryReload'].should.equal(true);

mockAlertService.successStatus$.next.should.have.been.calledWith({
title: 'Submit Transaction Successful',
text: '<p>Transaction ID <b>1</b> was submitted</p>',
icon: '#icon-transaction',
link: null,
linkCallback: null
});
}));
});

describe('initializeEventListener', () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/composer-playground/src/app/test/test.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ export class TestComponent implements OnInit, OnDestroy {

modalRef.result.then((transaction) => {
// refresh current resource list
if (this.chosenRegistry === this.registries['historian']) {
this.registryReload = !this.registryReload;
} else {
this.chosenRegistry = this.registries['historian'];
}
this.registryReload = !this.registryReload;

let plural = (this.eventsTriggered.length > 1) ? 's' : '';

Expand Down

0 comments on commit e00c03a

Please sign in to comment.