jazz-tools 0.8.17 → 0.8.19-group-inheritance.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +12 -0
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +144 -0
- package/CHANGELOG.md +15 -0
- package/dist/native/coValues/group.js +8 -0
- package/dist/native/coValues/group.js.map +1 -1
- package/dist/web/coValues/group.js +8 -0
- package/dist/web/coValues/group.js.map +1 -1
- package/package.json +2 -2
- package/src/coValues/group.ts +10 -0
- package/src/tests/groupsAndAccounts.test.ts +93 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
> jazz-tools@0.8.18 build /Users/anselm/jazz/jazz/packages/jazz-tools
|
3
|
+
> rm -rf ./dist && pnpm run build:web && pnpm run build:native
|
4
|
+
|
5
|
+
|
6
|
+
> jazz-tools@0.8.18 build:web /Users/anselm/jazz/jazz/packages/jazz-tools
|
7
|
+
> tsc --sourceMap --outDir dist/web -p tsconfig.web.json
|
8
|
+
|
9
|
+
|
10
|
+
> jazz-tools@0.8.18 build:native /Users/anselm/jazz/jazz/packages/jazz-tools
|
11
|
+
> tsc --sourceMap --outDir dist/native -p tsconfig.native.json
|
12
|
+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
|
2
|
+
> jazz-tools@0.7.35-unique.2 test /Users/anselm/jazz/jazz/packages/jazz-tools
|
3
|
+
> vitest --run
|
4
|
+
|
5
|
+
|
6
|
+
RUN v0.34.6 /Users/anselm/jazz/jazz/packages/jazz-tools
|
7
|
+
|
8
|
+
✓ src/tests/groupsAndAccounts.test.ts (1 test) 64ms
|
9
|
+
stdout | unknown test
|
10
|
+
TestMap schema [90mundefined[39m
|
11
|
+
|
12
|
+
✓ src/tests/deepLoading.test.ts (3 tests) 83ms
|
13
|
+
stdout | src/tests/coList.test.ts > Simple CoList operations > Mutation > splice
|
14
|
+
[ [32m'bread'[39m, [32m'onion'[39m ] [33m0[39m
|
15
|
+
[ [32m'bread'[39m, [32m'salt'[39m, [32m'onion'[39m ] [33m1[39m
|
16
|
+
|
17
|
+
stdout | src/tests/coList.test.ts > CoList resolution > Subscription & auto-resolution
|
18
|
+
subscribedList?.[0]?.[0]?.[0] [90mundefined[39m
|
19
|
+
subscribedList?.[0]?.[0]?.[0] [90mundefined[39m
|
20
|
+
subscribedList?.[0]?.[0]?.[0] a
|
21
|
+
subscribedList?.[0]?.[0]?.[0] x
|
22
|
+
subscribedList?.[0]?.[0]?.[0] y
|
23
|
+
subscribedList?.[0]?.[0]?.[0] w
|
24
|
+
|
25
|
+
✓ src/tests/coList.test.ts (10 tests) 190ms
|
26
|
+
stdout | src/tests/coStream.test.ts > CoStream resolution > Subscription & auto-resolution
|
27
|
+
subscribedStream[me.id] {
|
28
|
+
value: [36m[Getter][39m,
|
29
|
+
ref: [36m[Getter][39m,
|
30
|
+
by: [36m[Getter][39m,
|
31
|
+
madeAt: [35m2024-09-05T17:35:38.414Z[39m,
|
32
|
+
tx: {
|
33
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF'[39m,
|
34
|
+
txIndex: [33m0[39m
|
35
|
+
}
|
36
|
+
}
|
37
|
+
subscribedStream[me.id]?.value?.[me.id]?.value [90mundefined[39m
|
38
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value [90mundefined[39m
|
39
|
+
subscribedStream[me.id] {
|
40
|
+
value: [36m[Getter][39m,
|
41
|
+
ref: [36m[Getter][39m,
|
42
|
+
by: [36m[Getter][39m,
|
43
|
+
madeAt: [35m2024-09-05T17:35:38.414Z[39m,
|
44
|
+
tx: {
|
45
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF'[39m,
|
46
|
+
txIndex: [33m0[39m
|
47
|
+
}
|
48
|
+
}
|
49
|
+
subscribedStream[me.id]?.value?.[me.id]?.value [1mnull[22m
|
50
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value [90mundefined[39m
|
51
|
+
subscribedStream[me.id] {
|
52
|
+
value: [36m[Getter][39m,
|
53
|
+
ref: [36m[Getter][39m,
|
54
|
+
by: [36m[Getter][39m,
|
55
|
+
madeAt: [35m2024-09-05T17:35:38.414Z[39m,
|
56
|
+
tx: {
|
57
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF'[39m,
|
58
|
+
txIndex: [33m0[39m
|
59
|
+
}
|
60
|
+
}
|
61
|
+
subscribedStream[me.id]?.value?.[me.id]?.value {
|
62
|
+
id: [32m'co_zHELVqRmAN6YuGDpKqVrSXJ5qe1'[39m,
|
63
|
+
_type: [32m'CoStream'[39m,
|
64
|
+
perSession: [90mundefined[39m,
|
65
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri: [32m'milk'[39m,
|
66
|
+
in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF: [32m'milk'[39m }
|
67
|
+
}
|
68
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value milk
|
69
|
+
subscribedStream[me.id] {
|
70
|
+
value: [36m[Getter][39m,
|
71
|
+
ref: [36m[Getter][39m,
|
72
|
+
by: [36m[Getter][39m,
|
73
|
+
madeAt: [35m2024-09-05T17:35:38.414Z[39m,
|
74
|
+
tx: {
|
75
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF'[39m,
|
76
|
+
txIndex: [33m0[39m
|
77
|
+
}
|
78
|
+
}
|
79
|
+
subscribedStream[me.id]?.value?.[me.id]?.value {
|
80
|
+
id: [32m'co_zHELVqRmAN6YuGDpKqVrSXJ5qe1'[39m,
|
81
|
+
_type: [32m'CoStream'[39m,
|
82
|
+
perSession: [90mundefined[39m,
|
83
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri: [32m'bread'[39m,
|
84
|
+
in: {
|
85
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_ziAMdGVstAxF: [32m'milk'[39m,
|
86
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: [32m'bread'[39m
|
87
|
+
}
|
88
|
+
}
|
89
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value bread
|
90
|
+
subscribedStream[me.id] {
|
91
|
+
value: [36m[Getter][39m,
|
92
|
+
ref: [36m[Getter][39m,
|
93
|
+
by: [36m[Getter][39m,
|
94
|
+
madeAt: [35m2024-09-05T17:35:38.424Z[39m,
|
95
|
+
tx: {
|
96
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa'[39m,
|
97
|
+
txIndex: [33m0[39m
|
98
|
+
}
|
99
|
+
}
|
100
|
+
subscribedStream[me.id]?.value?.[me.id]?.value {
|
101
|
+
id: [32m'co_zJmdvJY15XJkWF3n3rwPgGfebxa'[39m,
|
102
|
+
_type: [32m'CoStream'[39m,
|
103
|
+
perSession: [90mundefined[39m,
|
104
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri: [32m'butter'[39m,
|
105
|
+
in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: [32m'butter'[39m }
|
106
|
+
}
|
107
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value butter
|
108
|
+
subscribedStream[me.id] {
|
109
|
+
value: [36m[Getter][39m,
|
110
|
+
ref: [36m[Getter][39m,
|
111
|
+
by: [36m[Getter][39m,
|
112
|
+
madeAt: [35m2024-09-05T17:35:38.424Z[39m,
|
113
|
+
tx: {
|
114
|
+
sessionID: [32m'co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa'[39m,
|
115
|
+
txIndex: [33m0[39m
|
116
|
+
}
|
117
|
+
}
|
118
|
+
subscribedStream[me.id]?.value?.[me.id]?.value {
|
119
|
+
id: [32m'co_zJmdvJY15XJkWF3n3rwPgGfebxa'[39m,
|
120
|
+
_type: [32m'CoStream'[39m,
|
121
|
+
perSession: [90mundefined[39m,
|
122
|
+
co_zURWEpvoH1e35FGHVxadgXKU8Ri: [32m'jam'[39m,
|
123
|
+
in: { co_zURWEpvoH1e35FGHVxadgXKU8Ri_session_zgik2JjD86Qa: [32m'jam'[39m }
|
124
|
+
}
|
125
|
+
subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value jam
|
126
|
+
|
127
|
+
✓ src/tests/coStream.test.ts (10 tests) 205ms
|
128
|
+
stdout | src/tests/coMap.test.ts > CoMap resolution > Subscription & auto-resolution
|
129
|
+
subscribedMap.nested?.twiceNested?.taste [90mundefined[39m
|
130
|
+
subscribedMap.nested?.twiceNested?.taste [90mundefined[39m
|
131
|
+
subscribedMap.nested?.twiceNested?.taste sour
|
132
|
+
subscribedMap.nested?.twiceNested?.taste sour
|
133
|
+
subscribedMap.nested?.twiceNested?.taste sweet
|
134
|
+
subscribedMap.nested?.twiceNested?.taste sweet
|
135
|
+
subscribedMap.nested?.twiceNested?.taste salty
|
136
|
+
subscribedMap.nested?.twiceNested?.taste umami
|
137
|
+
|
138
|
+
✓ src/tests/coMap.test.ts (20 tests) 257ms
|
139
|
+
|
140
|
+
Test Files 5 passed (5)
|
141
|
+
Tests 44 passed (44)
|
142
|
+
Start at 18:35:37
|
143
|
+
Duration 929ms (transform 419ms, setup 0ms, collect 2.29s, tests 799ms, environment 0ms, prepare 298ms)
|
144
|
+
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.8.19-group-inheritance.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 8b87117: Implement Group Inheritance
|
8
|
+
- Updated dependencies [8b87117]
|
9
|
+
- cojson@0.8.19-group-inheritance.0
|
10
|
+
|
11
|
+
## 0.8.18
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- Updated dependencies [d4319d8]
|
16
|
+
- cojson@0.8.18
|
17
|
+
|
3
18
|
## 0.8.17
|
4
19
|
|
5
20
|
### Patch Changes
|
@@ -75,6 +75,10 @@ export class Group extends CoValueBase {
|
|
75
75
|
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
76
76
|
return this;
|
77
77
|
}
|
78
|
+
removeMember(member) {
|
79
|
+
this._raw.removeMember(member === "everyone" ? member : member._raw);
|
80
|
+
return this;
|
81
|
+
}
|
78
82
|
get members() {
|
79
83
|
return this._raw
|
80
84
|
.keys()
|
@@ -97,6 +101,10 @@ export class Group extends CoValueBase {
|
|
97
101
|
};
|
98
102
|
});
|
99
103
|
}
|
104
|
+
extend(parent) {
|
105
|
+
this._raw.extend(parent._raw);
|
106
|
+
return this;
|
107
|
+
}
|
100
108
|
/** @category Subscription & Loading */
|
101
109
|
static load(id, as, depth) {
|
102
110
|
return loadCoValue(this, id, as, depth);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/coValues/group.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,OAAO,EACP,2BAA2B,EAC3B,KAAK,EACL,WAAW,EACX,UAAU,EACV,GAAG,EACH,EAAE,EACF,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAChC,IAAI,GAAG,EAAE,CAAC,MAAM,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,OAAO,KAAM,SAAQ,WAAW;IAGpC;QACE,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC;IACjC,CAAC;IAGD,8DAA8D;IAC9D,MAAM,CAAC,OAAO,CAAM;IACpB,IAAI,OAAO;QAKT,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAAO,CAAC;IACpD,CAAC;IACD;QACE,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,MAAuB;YAChC,IA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ET,EAAS,EACT,EAAW,EACX,KAA0B;QAE1B,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,SAAS,CAEd,EAAS,EACT,EAAW,EACX,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,kBAAkB,CAAW,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAED,uCAAuC;IACvC,YAAY,CAEV,KAA0B;QAE1B,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,uCAAuC;IACvC,SAAS,CAEP,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
@@ -75,6 +75,10 @@ export class Group extends CoValueBase {
|
|
75
75
|
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
76
76
|
return this;
|
77
77
|
}
|
78
|
+
removeMember(member) {
|
79
|
+
this._raw.removeMember(member === "everyone" ? member : member._raw);
|
80
|
+
return this;
|
81
|
+
}
|
78
82
|
get members() {
|
79
83
|
return this._raw
|
80
84
|
.keys()
|
@@ -97,6 +101,10 @@ export class Group extends CoValueBase {
|
|
97
101
|
};
|
98
102
|
});
|
99
103
|
}
|
104
|
+
extend(parent) {
|
105
|
+
this._raw.extend(parent._raw);
|
106
|
+
return this;
|
107
|
+
}
|
100
108
|
/** @category Subscription & Loading */
|
101
109
|
static load(id, as, depth) {
|
102
110
|
return loadCoValue(this, id, as, depth);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/coValues/group.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,OAAO,EACP,2BAA2B,EAC3B,KAAK,EACL,WAAW,EACX,UAAU,EACV,GAAG,EACH,E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CAAC,SAAS,EACd,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CACzB,CAAC;YACJ,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,CAAC,CAAC;YAE/D,OAAO;gBACL,EAAE,EAAE,EAAgD;gBACpD,IAAI;gBACJ,GAAG;gBACH,IAAI,OAAO;oBACT,OAAO,SAAS,EAAE,CAAC;gBACrB,CAAC;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,MAAa;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,IAAI,CAET,EAAS,EACT,EAAW,EACX,KAA0B;QAE1B,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,SAAS,CAEd,EAAS,EACT,EAAW,EACX,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,kBAAkB,CAAW,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAED,uCAAuC;IACvC,YAAY,CAEV,KAA0B;QAE1B,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,uCAAuC;IACvC,SAAS,CAEP,KAA0B,EAC1B,QAAiD;QAEjD,OAAO,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -19,10 +19,10 @@
|
|
19
19
|
},
|
20
20
|
"type": "module",
|
21
21
|
"license": "MIT",
|
22
|
-
"version": "0.8.
|
22
|
+
"version": "0.8.19-group-inheritance.0",
|
23
23
|
"dependencies": {
|
24
24
|
"fast-check": "^3.17.2",
|
25
|
-
"cojson": "0.8.
|
25
|
+
"cojson": "0.8.19-group-inheritance.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"typescript": "^5.3.3",
|
package/src/coValues/group.ts
CHANGED
@@ -142,6 +142,11 @@ export class Group extends CoValueBase implements CoValue {
|
|
142
142
|
return this;
|
143
143
|
}
|
144
144
|
|
145
|
+
removeMember(member: Everyone | Account) {
|
146
|
+
this._raw.removeMember(member === "everyone" ? member : member._raw);
|
147
|
+
return this;
|
148
|
+
}
|
149
|
+
|
145
150
|
get members() {
|
146
151
|
return this._raw
|
147
152
|
.keys()
|
@@ -172,6 +177,11 @@ export class Group extends CoValueBase implements CoValue {
|
|
172
177
|
});
|
173
178
|
}
|
174
179
|
|
180
|
+
extend(parent: Group) {
|
181
|
+
this._raw.extend(parent._raw);
|
182
|
+
return this;
|
183
|
+
}
|
184
|
+
|
175
185
|
/** @category Subscription & Loading */
|
176
186
|
static load<G extends Group, Depth>(
|
177
187
|
this: CoValueClass<G>,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { RawGroup } from "cojson";
|
1
2
|
import { describe, expect, test } from "vitest";
|
2
3
|
import { Account, CoMap, Group, WasmCrypto, co } from "../index.web.js";
|
3
4
|
|
@@ -85,3 +86,95 @@ describe("Custom accounts and groups", async () => {
|
|
85
86
|
expect(map._owner.castAs(CustomGroup).nMembers).toBe(2);
|
86
87
|
});
|
87
88
|
});
|
89
|
+
|
90
|
+
describe("Group inheritance", () => {
|
91
|
+
class TestMap extends CoMap {
|
92
|
+
title = co.string;
|
93
|
+
}
|
94
|
+
|
95
|
+
test("Group inheritance", async () => {
|
96
|
+
const me = await Account.create({
|
97
|
+
creationProps: { name: "Hermes Puggington" },
|
98
|
+
crypto: Crypto,
|
99
|
+
});
|
100
|
+
|
101
|
+
const parentGroup = Group.create({ owner: me });
|
102
|
+
const group = Group.create({ owner: me });
|
103
|
+
|
104
|
+
group.extend(parentGroup);
|
105
|
+
|
106
|
+
console.log(
|
107
|
+
group.id,
|
108
|
+
group._raw.core.getDependedOnCoValuesUncached(),
|
109
|
+
parentGroup.id,
|
110
|
+
);
|
111
|
+
|
112
|
+
console.log(
|
113
|
+
(group._raw.core.getCurrentContent() as RawGroup)
|
114
|
+
.keys()
|
115
|
+
.filter((k) => k.startsWith("parent_"))
|
116
|
+
.map((k) => k.replace("parent_", "")),
|
117
|
+
);
|
118
|
+
|
119
|
+
const reader = await Account.createAs(me, {
|
120
|
+
creationProps: { name: "Reader" },
|
121
|
+
});
|
122
|
+
|
123
|
+
parentGroup.addMember(reader, "reader");
|
124
|
+
|
125
|
+
const mapInChild = TestMap.create({ title: "In Child" }, { owner: group });
|
126
|
+
|
127
|
+
const mapAsReader = await TestMap.load(mapInChild.id, reader, {});
|
128
|
+
expect(mapAsReader?.title).toBe("In Child");
|
129
|
+
|
130
|
+
parentGroup.removeMember(reader);
|
131
|
+
|
132
|
+
mapInChild.title = "In Child (updated)";
|
133
|
+
|
134
|
+
const mapAsReaderAfterUpdate = await TestMap.load(
|
135
|
+
mapInChild.id,
|
136
|
+
reader,
|
137
|
+
{},
|
138
|
+
);
|
139
|
+
expect(mapAsReaderAfterUpdate?.title).toBe("In Child");
|
140
|
+
});
|
141
|
+
|
142
|
+
test("Group inheritance with grand-children", async () => {
|
143
|
+
const me = await Account.create({
|
144
|
+
creationProps: { name: "Hermes Puggington" },
|
145
|
+
crypto: Crypto,
|
146
|
+
});
|
147
|
+
|
148
|
+
const grandParentGroup = Group.create({ owner: me });
|
149
|
+
const parentGroup = Group.create({ owner: me });
|
150
|
+
const group = Group.create({ owner: me });
|
151
|
+
|
152
|
+
group.extend(parentGroup);
|
153
|
+
parentGroup.extend(grandParentGroup);
|
154
|
+
|
155
|
+
const reader = await Account.createAs(me, {
|
156
|
+
creationProps: { name: "Reader" },
|
157
|
+
});
|
158
|
+
|
159
|
+
grandParentGroup.addMember(reader, "reader");
|
160
|
+
|
161
|
+
const mapInGrandChild = TestMap.create(
|
162
|
+
{ title: "In Grand Child" },
|
163
|
+
{ owner: group },
|
164
|
+
);
|
165
|
+
|
166
|
+
const mapAsReader = await TestMap.load(mapInGrandChild.id, reader, {});
|
167
|
+
expect(mapAsReader?.title).toBe("In Grand Child");
|
168
|
+
|
169
|
+
grandParentGroup.removeMember(reader);
|
170
|
+
|
171
|
+
mapInGrandChild.title = "In Grand Child (updated)";
|
172
|
+
|
173
|
+
const mapAsReaderAfterUpdate = await TestMap.load(
|
174
|
+
mapInGrandChild.id,
|
175
|
+
reader,
|
176
|
+
{},
|
177
|
+
);
|
178
|
+
expect(mapAsReaderAfterUpdate?.title).toBe("In Grand Child");
|
179
|
+
});
|
180
|
+
});
|