Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 969bad0

Browse files
committed
remove test runner workaround, fix TS config and reorganise test deps for direct compat with Tape
1 parent 0a97ab9 commit 969bad0

File tree

9 files changed

+86
-96
lines changed

9 files changed

+86
-96
lines changed

src/index.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/sensemaker_dna/sensemaker/applet_config.ts renamed to src/sensemaker_dna/applet_config.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { AppEntryDef, EntryHash } from "@holochain/client";
1+
type AppEntryDef = import('@holochain/client').AppEntryDef;
2+
type EntryHash = import('@holochain/client').EntryHash;
3+
4+
import { AppletConfig, AppletConfigInput, ConfigCulturalContext, ConfigMethod, ConfigResourceDef, ConfigThreshold, CreateAppletConfigInput, CulturalContext, Dimension, Method, Range, Threshold } from "@neighbourhoods/client"
5+
26
import { cleanAllConductors, pause, runScenario } from "@holochain/tryorama";
37
//@ts-ignore
4-
import { AppletConfig, AppletConfigInput, ConfigCulturalContext, ConfigMethod, ConfigResourceDef, ConfigThreshold, CreateAppletConfigInput, CulturalContext, Dimension, Method, Range, Threshold } from "@neighbourhoods/client";
5-
import pkg from "tape-promise/tape";
8+
import test from "tape-promise/tape";
69

7-
import { setUpAliceandBob } from "./neighbourhood";
8-
const { test } = pkg;
10+
import { setUpAliceandBob } from "../utils";
911

1012
const app_entry_def: AppEntryDef = { entry_index: 0, zome_index: 0, visibility: { Public: null } };
11-
export default () =>
13+
1214
test("test Sensemaker Configuration", async (t) => {
1315
await runScenario(async (scenario) => {
1416
const {
@@ -272,4 +274,3 @@ export default () =>
272274
await cleanAllConductors();
273275
});
274276
});
275-

src/sensemaker_dna/sensemaker/community_activator.ts renamed to src/sensemaker_dna/community_activator.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { DnaSource, Record, ActionHash, EntryHash } from "@holochain/client";
22
import { pause, runScenario, cleanAllConductors, createConductor, addAllAgentsToAllConductors } from "@holochain/tryorama";
33
import { decode } from '@msgpack/msgpack';
4-
import pkg from 'tape-promise/tape';
5-
import { installAgent } from "../../utils";
4+
import test from "tape-promise/tape";
5+
import { installAgent } from "../utils";
66
import { setUpAliceandBob } from "./neighbourhood";
7-
const { test } = pkg;
87

9-
export default () => test("test CA progenitor pattern", async (t) => {
8+
test("test CA progenitor pattern", async (t) => {
109
await runScenario(async scenario => {
1110
const { alice, bob, alice_happs, bob_happs, alice_agent_key, bob_agent_key, ss_cell_id_alice, ss_cell_id_bob, provider_cell_id_alice, provider_cell_id_bob } = await setUpAliceandBob();
1211

src/sensemaker_dna/sensemaker/dashboard.ts renamed to src/sensemaker_dna/dashboard.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import {
1010
import { decode } from "@msgpack/msgpack";
1111
import { AppletConfig, Assessment, AssessmentWithDimensionAndResource, CreateAppletConfigInput, CreateAssessmentInput, Method, RangeValueInteger } from "@neighbourhoods/client";
1212
import { ok } from "assert";
13-
import pkg from "tape-promise/tape";
14-
import { installAgent, sampleAppletConfig } from "../../utils";
15-
const { test } = pkg;
13+
import test from "tape-promise/tape";
14+
import { installAgent, sampleAppletConfig } from "../utils";
1615

1716
interface TestPost {
1817
title: string;
@@ -64,7 +63,6 @@ export const setUpAliceandBob = async (
6463
};
6564
};
6665

67-
export default () => {
6866
test("test fetching dashboard data", async (t) => {
6967
await runScenario(async (scenario) => {
7068
const {
@@ -312,5 +310,3 @@ export default () => {
312310
await cleanAllConductors();
313311
});
314312
});
315-
};
316-

src/sensemaker_dna/sensemaker/neighbourhood.ts renamed to src/sensemaker_dna/neighbourhood.ts

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DnaSource, Record, ActionHash, EntryHash, EntryHashB64, encodeHashToBase64 } from "@holochain/client";
1+
import { Record, CellId, EntryHash, EntryHashB64, encodeHashToBase64 } from "@holochain/client";
22
import {
33
pause,
44
runScenario,
@@ -10,56 +10,9 @@ import {
1010
import { decode } from "@msgpack/msgpack";
1111
import { Assessment, AssessmentWithDimensionAndResource, CreateAssessmentInput, Method, RangeValueInteger, ResourceEh, GetAssessmentsForResourceInput } from "@neighbourhoods/client";
1212
import { ok } from "assert";
13-
import pkg from "tape-promise/tape";
14-
import { installAgent } from "../../utils";
15-
const { test } = pkg;
16-
17-
export const setUpAliceandBob = async (
18-
with_config: boolean = false,
19-
resource_base_type?: any
20-
) => {
21-
const alice = await createConductor();
22-
const bob = await createConductor();
23-
const {
24-
agentsHapps: alice_happs,
25-
agent_key: alice_agent_key,
26-
ss_cell_id: ss_cell_id_alice,
27-
provider_cell_id: provider_cell_id_alice,
28-
} = await installAgent(
29-
alice,
30-
"alice",
31-
undefined,
32-
with_config,
33-
resource_base_type
34-
);
35-
const {
36-
agentsHapps: bob_happs,
37-
agent_key: bob_agent_key,
38-
ss_cell_id: ss_cell_id_bob,
39-
provider_cell_id: provider_cell_id_bob,
40-
} = await installAgent(
41-
bob,
42-
"bob",
43-
alice_agent_key,
44-
with_config,
45-
resource_base_type
46-
);
47-
await addAllAgentsToAllConductors([alice, bob]);
48-
return {
49-
alice,
50-
bob,
51-
alice_happs,
52-
bob_happs,
53-
alice_agent_key,
54-
bob_agent_key,
55-
ss_cell_id_alice,
56-
ss_cell_id_bob,
57-
provider_cell_id_alice,
58-
provider_cell_id_bob,
59-
};
60-
};
61-
62-
export default () => {
13+
import test from "tape-promise/tape";
14+
import { setUpAliceandBob } from "../utils";
15+
6316
test("SM entry type CRUD tests", async (t) => {
6417
await runScenario(async (scenario) => {
6518
const {
@@ -1261,7 +1214,7 @@ export default () => {
12611214
author: alice_agent_key,
12621215
timestamp: runMethodOutput.timestamp,
12631216
};
1264-
1217+
12651218
t.deepEqual(
12661219
objectiveAssessment,
12671220
runMethodOutput
@@ -1276,4 +1229,3 @@ export default () => {
12761229
await cleanAllConductors();
12771230
});
12781231
});
1279-
};

src/sensemaker_dna/sensemaker/range.ts renamed to src/sensemaker_dna/range.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import { DnaSource, Record, ActionHash, AppBundleSource, AppEntryDef, EntryHash } from "@holochain/client";
33
import { cleanAllConductors, pause, runScenario } from "@holochain/tryorama";
44
import { decode } from '@msgpack/msgpack';
5-
import pkg from 'tape-promise/tape';
6-
const { test } = pkg;
5+
import test from "tape-promise/tape";
76

8-
import { sensemakerDna } from "../../utils";
7+
import { sensemakerDna } from "../utils";
98
import { setUpAliceandBob } from "./neighbourhood";
109

1110
const app_entry_def: AppEntryDef = { entry_index: 0, zome_index: 0, visibility: { Public: null } };
12-
export default () => test("range CRUD tests", async (t) => {
11+
test("range CRUD tests", async (t) => {
1312
await runScenario(async scenario => {
1413
const {
1514
alice,

src/sensemaker_dna/sensemaker/sm_config.ts renamed to src/sensemaker_dna/sm_config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { DnaSource, Record, ActionHash, EntryHash, AppEntryDef, encodeHashToBase64 } from "@holochain/client";
22
import { cleanAllConductors, pause, runScenario } from "@holochain/tryorama";
33
import { decode } from "@msgpack/msgpack";
4-
import pkg from "tape-promise/tape";
4+
import test from "tape-promise/tape";
55
import { setUpAliceandBob } from "./neighbourhood";
6-
const { test } = pkg;
76

87
let app_entry_def: AppEntryDef = { entry_index: 0, zome_index: 0, visibility: { Public: null } };
9-
export default () =>
8+
109
test("test Sensemaker and Applet Configuration in DNA Property", async (t) => {
1110
await runScenario(async (scenario) => {
1211
const {
@@ -221,4 +220,3 @@ test("test updating of sensemaker config", async (t) => {
221220
await cleanAllConductors();
222221
});
223222
});
224-

src/utils.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ import {
33
AppInfo,
44
InstallAppRequest,
55
encodeHashToBase64,
6+
CellId,
67
CellInfo,
78
ProvisionedCell,
89
CellType
910
} from "@holochain/client";
1011
import {
1112
Conductor,
13+
createConductor,
14+
addAllAgentsToAllConductors,
1215
} from "@holochain/tryorama";
1316
import { AppletConfigInput } from "@neighbourhoods/client";
1417
import path from "path";
@@ -26,6 +29,51 @@ export const testProviderDna = path.join(
2629
"../../dnas/test_provider/workdir/test_provider_dna.dna"
2730
);
2831

32+
export const setUpAliceandBob = async (
33+
with_config: boolean = false,
34+
resource_base_type?: any
35+
) => {
36+
const alice = await createConductor();
37+
const bob = await createConductor();
38+
const {
39+
agentsHapps: alice_happs,
40+
agent_key: alice_agent_key,
41+
ss_cell_id: ss_cell_id_alice,
42+
provider_cell_id: provider_cell_id_alice,
43+
} = await installAgent(
44+
alice,
45+
"alice",
46+
undefined,
47+
with_config,
48+
resource_base_type
49+
);
50+
const {
51+
agentsHapps: bob_happs,
52+
agent_key: bob_agent_key,
53+
ss_cell_id: ss_cell_id_bob,
54+
provider_cell_id: provider_cell_id_bob,
55+
} = await installAgent(
56+
bob,
57+
"bob",
58+
alice_agent_key,
59+
with_config,
60+
resource_base_type
61+
);
62+
await addAllAgentsToAllConductors([alice, bob]);
63+
return {
64+
alice,
65+
bob,
66+
alice_happs,
67+
bob_happs,
68+
alice_agent_key: alice_agent_key as Uint8Array,
69+
bob_agent_key: bob_agent_key as Uint8Array,
70+
ss_cell_id_alice: ss_cell_id_alice as CellId,
71+
ss_cell_id_bob: ss_cell_id_bob as CellId,
72+
provider_cell_id_alice: provider_cell_id_alice as CellId,
73+
provider_cell_id_bob: provider_cell_id_bob as CellId,
74+
};
75+
};
76+
2977
export const installAgent = async (
3078
conductor: Conductor,
3179
agentName: string,
@@ -276,4 +324,4 @@ export const sampleAppletConfig = (resource_base_def: AppEntryDef) => {
276324
],
277325
};
278326
return config;
279-
};
327+
};

tsconfig.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,26 @@
33
/* Visit https://aka.ms/tsconfig.json to read more about this file */
44
/* Basic Options */
55
"outDir": "dist",
6-
"target": "ES2017",
7-
"module": "ESNext",
6+
"target": "ES2018",
7+
"module": "esNext",
88
"moduleResolution": "node",
9+
"lib": ["es2017", "dom"],
10+
"sourceMap": true,
911
/* Strict Type-Checking Options */
1012
"strict": true /* Enable all strict type-checking options. */,
1113
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
14+
"allowSyntheticDefaultImports": true,
1215
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */,
1316
/* Advanced Options */
1417
"skipLibCheck": true /* Skip type checking of declaration files. */,
1518
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
16-
}
19+
},
20+
"include": [
21+
"src/**/*.ts",
22+
"../client/src/**/*.ts"
23+
],
24+
"exclude": [
25+
"node_modules",
26+
"../node_modules"
27+
]
1728
}

0 commit comments

Comments
 (0)