Skip to content

Commit

Permalink
Merge pull request #74 from holochain/add-app-id-test
Browse files Browse the repository at this point in the history
add installed-app-id test
  • Loading branch information
zippy authored Apr 5, 2021
2 parents 4e11964 + 5feb9a7 commit c9e900b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class Player {
* otherwise will be a new and different agent every time you call it
*/
installBundledHapp = async (bundleSource: AppBundleSource, agentPubKey?: AgentPubKey, installedAppId?: string): Promise<InstalledHapp> => {
this._conductorGuard(`Player.installBundledHapp(${JSON.stringify(bundleSource)}, ${agentPubKey ? 'noAgentPubKey' : 'withAgentPubKey'})`)
this._conductorGuard(`Player.installBundledHapp(${JSON.stringify(bundleSource)}, ${agentPubKey ? 'withAgentPubKey' : 'noAgentPubKey'}, ${installedAppId || 'noInstalledAppId'})`)
return this._conductor!.installBundledHapp(bundleSource, agentPubKey, installedAppId)
}

Expand Down
21 changes: 21 additions & 0 deletions test/e2e/test-always-on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,25 @@ export default (testOrchestrator, testConfig, playersFn = (s, ...args) => s.play
console.log(stats)
t.end()
})

test('test with happ bundles including installed_app_id', async t => {
t.plan(4)
const [conductorConfig, _installApps] = testConfig()
const orchestrator = await testOrchestrator()
orchestrator.registerScenario('installBundledHapp', async (s: ScenarioApi) => {
const [alice] = await playersFn(s, [conductorConfig])
const bundlePath = path.join(__dirname, 'fixture', 'test.happ')
const installedAppId = 'test-id'
const alice_happ = await alice.installBundledHapp({ path: bundlePath }, null, installedAppId)
const hash = await alice_happ.cells[0].call('test', 'create_link')
t.equal(hash.length, 39, 'zome call succeeded')
const [appId] = await alice.adminWs().listActiveApps()
t.equal(appId, installedAppId, 'installation with correct `installed_app_id` succeeded')
})
const stats = await orchestrator.run()
t.equal(stats.successes, 1, 'only success')
t.equal(stats.errors.length, 0, 'no errors')
console.log(stats)
t.end()
})
}

0 comments on commit c9e900b

Please sign in to comment.