With the implementation of cards in v0.15, previous versions of test routines which used profiles (obviously) won't work. However, I cannot find an SDK approach to create the necessary cards to run tests. The 'before' section of code up through v0.14 for my tests has looked like the following, which uses an embedded profile, creates a temporary instance of the network and runs the tests:
describe('Finance Network', () => {
// let adminConnection;
let businessNetworkConnection;
before(() => {
BrowserFS.initialize(new BrowserFS.FileSystem.InMemory());
const adminConnection = new AdminConnection({ fs: bfs_fs });
return adminConnection.createProfile('defaultProfile', {
type: 'embedded'
})
.then(() => {
return adminConnection.connect('defaultProfile', adminID, adminPW);
})
.then(() => {
return BusinessNetworkDefinition.fromDirectory(path.resolve(__dirname, '..'));
})
.then((businessNetworkDefinition) => {
return adminConnection.deploy(businessNetworkDefinition);
})
.then(() => {
businessNetworkConnection = new BusinessNetworkConnection({ fs: bfs_fs });
return businessNetworkConnection.connect('defaultProfile', network, adminID, adminPW);
});
});
What I'm trying to find (and haven't yet) in the nodejs documentation is how to create the necessary cards to make this work, while using this same approach.
I expect to replace the following lines of code with something that creates the necessary cards:
return adminConnection.createProfile('defaultProfile', {
type: 'embedded'
})
.then(() => {
return adminConnection.connect('defaultProfile', adminID, adminPW);
})
The only place where I see card creation is in composer-client Participant Registry, but it's a Catch-22 situation where I have to be connected to create the card, but I need a card to get connected. What is the recommended approach for writing mocha-based testing as we have been doing for the past umpteen releases of Hyperledger-Composer?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…