This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.ts
35 lines (26 loc) · 1.09 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Orchestrator, Config, InstallAgentsHapps } from "@holochain/tryorama";
import path from "path";
const conductorConfig = Config.gen();
// Construct proper paths for your DNAs
const demoDnaPath = path.join(__dirname, "../../workdir/dna/demo-dna.dna");
// create an InstallAgentsHapps array with your DNAs to tell tryorama what
// to install into the conductor.
const installation: InstallAgentsHapps = [
// agent 0
[
// happ 0
[demoDnaPath],
],
];
const sleep = (ms) =>
new Promise((resolve) => setTimeout(() => resolve(null), ms));
const orchestrator = new Orchestrator();
orchestrator.registerScenario("sample test", async (s, t) => {
const [alice] = await s.players([conductorConfig]);
// install your happs into the coductors and destructuring the returned happ data using the same
// array structure as you created in your installation array.
const [[alice_common]] = await alice.installAgentsHapps(installation);
let result = await alice_common.cells[0].call("numbers", "add_ten", { number: 10 });
t.deepEqual(result, { other_number: 20 });
});
orchestrator.run();