Skip to content

Commit

Permalink
Fix adding new model files and namespace change (hyperledger-archives…
Browse files Browse the repository at this point in the history
…#2628)

Updated so that model files get a file name when created

closes hyperledger/composer#2532

Signed-off-by: Caroline Church <[email protected]>
  • Loading branch information
cazfletch authored Nov 8, 2017
1 parent d4323cf commit f810f7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,11 @@ transaction SampleTransaction {
validateQuerySpy.should.not.have.been.called;
});
});

describe('getDisplayId', () => {
it('should get the display id', () => {
let result = file.getDisplayId();
result.should.equal('fileDisplayID');
});
});
});
4 changes: 4 additions & 0 deletions packages/composer-playground/src/app/services/editor-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class EditorFile {
return modelFile.getNamespace();
}

getDisplayId() {
return this.displayID;
}

setId(id) {
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ describe('FileService', () => {

fileService.updateBusinessNetwork('oldId', editorFile);

mockModelManager.addModelFile.should.have.been.calledWith('myContent');
mockModelManager.addModelFile.should.have.been.calledWith('myContent', 'myDisplayId');
}));

it('should update a script file', inject([FileService], (fileService: FileService) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export class FileService {
if (this.getModelFile(oldId)) {
this.updateBusinessNetworkFile(oldId, editorFile.getContent(), editorFile.getType());
} else {
this.currentBusinessNetwork.getModelManager().addModelFile(editorFile.getContent());
this.currentBusinessNetwork.getModelManager().addModelFile(editorFile.getContent(), editorFile.getDisplayId());
}
} else if (editorFile.isAcl()) {
if (this.getAclFile()) {
Expand Down

0 comments on commit f810f7e

Please sign in to comment.