Skip to content

Commit f4e52c7

Browse files
committed
use js-yaml in test
1 parent 9539e9e commit f4e52c7

File tree

8 files changed

+33
-7
lines changed

8 files changed

+33
-7
lines changed

docs/client.dnamodifiersopt.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## DnaModifiersOpt type
66

7+
78
**Signature:**
89

910
```typescript

docs/client.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,7 @@ This type is meant to be opaque
18711871
</td><td>
18721872

18731873

1874+
18741875
</td></tr>
18751876
<tr><td>
18761877

@@ -2736,6 +2737,7 @@ If the key could not be deleted from all cells, the call [RevokeAgentKeyRequest]
27362737
</td><td>
27372738

27382739

2740+
27392741
</td></tr>
27402742
<tr><td>
27412743

docs/client.rolesettings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## RoleSettings type
66

7+
78
**Signature:**
89

910
```typescript

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@
4848
"isomorphic-ws": "^5.0.0",
4949
"js-base64": "^3.7.5",
5050
"js-sha512": "^0.9.0",
51+
"js-yaml": "4.1.0",
5152
"libsodium-wrappers": "^0.7.13",
5253
"lodash-es": "^4.17.21",
5354
"ws": "^8.14.2"
5455
},
5556
"devDependencies": {
5657
"@microsoft/api-documenter": "^7.21.7",
5758
"@microsoft/api-extractor": "^7.34.4",
59+
"@types/js-yaml": "4.0.9",
5860
"@types/libsodium-wrappers": "^0.7.11",
5961
"@types/lodash-es": "^4.17.6",
6062
"@types/tape": "^4.13.2",

src/api/admin/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ export type MemproofMap = { [key: RoleName]: MembraneProof };
163163
*/
164164
export type RoleSettingsMap = { [key: RoleName]: RoleSettings };
165165

166+
/**
167+
* @public
168+
*/
166169
export type RoleSettings =
167170
| {
168171
type: "UseExisting";
@@ -175,11 +178,15 @@ export type RoleSettings =
175178
};
176179

177180
/**
181+
* @public
178182
* Any value that is serializable to a Yaml value
179183
*/
180184
// eslint-disable-next-line @typescript-eslint/no-explicit-any
181185
export type YamlProperties = any;
182186

187+
/**
188+
* @public
189+
*/
183190
export type DnaModifiersOpt = {
184191
network_seed?: NetworkSeed;
185192
properties?: YamlProperties;

test/e2e/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const installAppAndDna = async (
117117
installed_app_id,
118118
agent_key: agent,
119119
path,
120-
membrane_proofs: {},
120+
roles_settings: {},
121121
});
122122
assert(CellType.Provisioned in app.cell_info[role_name][0]);
123123
const cell_id = app.cell_info[role_name][0][CellType.Provisioned].cell_id;
@@ -159,7 +159,7 @@ export const createAppWsAndInstallApp = async (
159159
installed_app_id,
160160
agent_key: agent,
161161
path,
162-
membrane_proofs: {},
162+
roles_settings: {},
163163
});
164164
assert(CellType.Provisioned in app.cell_info[role_name][0]);
165165
const cell_id = app.cell_info[role_name][0][CellType.Provisioned].cell_id;

test/e2e/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { decode, encode } from "@msgpack/msgpack";
1+
import { decode } from "@msgpack/msgpack";
22
import assert from "node:assert/strict";
33
import fs from "node:fs";
44
import test from "tape";
5+
import yaml from "js-yaml";
56
import zlib from "zlib";
67
import {
78
ActionHash,
@@ -580,6 +581,8 @@ test(
580581
nanos: 0,
581582
};
582583

584+
const progenitorKey = fakeAgentPubKey();
585+
583586
await admin.installApp({
584587
installed_app_id,
585588
agent_key: agent,
@@ -610,7 +613,7 @@ test(
610613
membrane_proof: new Uint8Array(6),
611614
modifiers: {
612615
network_seed: "hello",
613-
properties: { specialProp: "prop" },
616+
properties: yaml.dump({ progenitor: progenitorKey }),
614617
origin_time: originTime,
615618
quantum_time: quantumTime,
616619
},
@@ -623,9 +626,10 @@ test(
623626
const provisionedCell: ProvisionedCell =
624627
appInfo.cell_info["foo"][0][CellType.Provisioned];
625628
t.equal(provisionedCell.dna_modifiers.network_seed, "hello");
626-
t.deepEqual(decode(provisionedCell.dna_modifiers.properties), {
627-
specialProp: "prop",
628-
});
629+
t.deepEqual(
630+
yaml.load(decode(provisionedCell.dna_modifiers.properties) as string),
631+
{ progenitor: progenitorKey }
632+
);
629633
t.equal(provisionedCell.dna_modifiers.origin_time, originTime);
630634
t.deepEqual(provisionedCell.dna_modifiers.quantum_time, quantumTime);
631635
})

0 commit comments

Comments
 (0)