@ibgib/ts-gib 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/README.md +22 -3
- package/dist/respec-gib.node.d.mts +2 -0
- package/dist/respec-gib.node.d.mts.map +1 -0
- package/dist/respec-gib.node.mjs +211 -0
- package/dist/respec-gib.node.mjs.map +1 -0
- package/package.json +10 -13
- package/src/V1/{factory.spec.mts → factory.respec.mts} +30 -28
- package/src/V1/{sha256v1.spec.mts → sha256v1.respec.mts} +23 -13
- package/src/V1/transforms/fork.spec.mts +126 -126
- package/src/V1/transforms/mut8.spec.mts +174 -174
- package/src/V1/transforms/rel8.spec.mts +109 -109
- package/src/V1/transforms/transform-helper.spec.mts +5 -5
- package/src/helper.respec.mts +62 -0
- package/src/respec-gib.node.mts +199 -0
- package/tsconfig.json +3 -1
- package/tsconfig.test.json +4 -2
- package/jasmine-browser.json +0 -18
- package/jasmine.json +0 -6
- package/src/helper.spec.mts +0 -59
|
@@ -43,58 +43,58 @@ const DATAS_SIMPLE = [
|
|
|
43
43
|
DATA_SIMPLE_XY_STR,
|
|
44
44
|
];
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
await respecfully(sir, `can't mut8 primitives (including the root)`, async () => {
|
|
47
47
|
for (const src of PRIMITIVE_IBGIBS) {
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
await ifWe(sir, `should fail to mut8 ib (ib: ${src.ib})`, async () => {
|
|
50
50
|
let errored = false;
|
|
51
51
|
try {
|
|
52
52
|
const _ignored = await mut8({ src, mut8Ib: 'changed ' + src.ib });
|
|
53
53
|
} catch (error) {
|
|
54
54
|
errored = true;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
iReckon(sir, errored).toBeTrue()
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
await ifWe(sir, `should fail to mut8 add or patch data (ib: ${src.ib})`, async () => {
|
|
60
60
|
let errored = false;
|
|
61
61
|
try {
|
|
62
62
|
const _ignored = await mut8({ src, dataToAddOrPatch: { a: "aaaaa" } });
|
|
63
63
|
} catch (error) {
|
|
64
64
|
errored = true;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
iReckon(sir, errored).toBeTrue()
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
await ifWe(sir, `should fail to mut8 rename data (ib: ${src.ib})`, async () => {
|
|
70
70
|
let errored = false;
|
|
71
71
|
try {
|
|
72
72
|
const _ignored = await mut8({ src, dataToRename: { a: "aaaaa" } });
|
|
73
73
|
} catch (error) {
|
|
74
74
|
errored = true;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
iReckon(sir, errored).toBeTrue()
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
await ifWe(sir, `should fail to mut8 remove data (ib: ${src.ib})`, async () => {
|
|
80
80
|
let errored = false;
|
|
81
81
|
try {
|
|
82
82
|
const _ignored = await mut8({ src, dataToRemove: { a: "aaaaa" } });
|
|
83
83
|
} catch (error) {
|
|
84
84
|
errored = true;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
iReckon(sir, errored).toBeTrue()
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
await respecfully(sir, `with simple, 1-level, non-nested data and ib`, async () => {
|
|
94
94
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
95
95
|
for (const testData of DATAS_SIMPLE) {
|
|
96
96
|
// console.log(`doing testdata: ${primitive.ib}.data ~ ${pretty(testData)}`);
|
|
97
|
-
|
|
97
|
+
await ifWe(sir, `should add/rename/patch simple data (${primitive.ib}) and ib`, async () => {
|
|
98
98
|
|
|
99
99
|
let { newIbGib: src } = await fork({ src: primitive, noTimestamp: true });
|
|
100
100
|
|
|
@@ -110,15 +110,15 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
110
110
|
linkedRel8ns: ['past'],
|
|
111
111
|
});
|
|
112
112
|
let dataAddedAddr: IbGibAddr = getIbGibAddr({ ibGib: dataAddedIbGib });
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.
|
|
121
|
-
.
|
|
113
|
+
iReckon(sir, dataAddedIbGib).isGonnaBeTruthy();
|
|
114
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBeTruthy();
|
|
115
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBeTruthy();
|
|
116
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBe(testData);
|
|
117
|
+
iReckon(sir, dataAddedIbGib.rel8ns).isGonnaBeTruthy();
|
|
118
|
+
iReckon(sir, dataAddedIbGib.rel8ns!.past).isGonnaBeTruthy();
|
|
119
|
+
iReckon(sir, (dataAddedIbGib.rel8ns!.past || []).length)
|
|
120
|
+
.asTo('(dataAddedIbGib.rel8ns!.past || []).length')
|
|
121
|
+
.isGonnaBe(1);
|
|
122
122
|
|
|
123
123
|
// #endregion
|
|
124
124
|
|
|
@@ -135,23 +135,23 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
135
135
|
noTimestamp: true,
|
|
136
136
|
linkedRel8ns: ['past'],
|
|
137
137
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.
|
|
145
|
-
.
|
|
138
|
+
iReckon(sir, dataRenamedIbGib).isGonnaBeTruthy();
|
|
139
|
+
iReckon(sir, dataRenamedIbGib.data).isGonnaBeTruthy();
|
|
140
|
+
iReckon(sir, dataRenamedIbGib.data).isGonnaBeTruthy();
|
|
141
|
+
iReckon(sir, dataRenamedIbGib.rel8ns).isGonnaBeTruthy();
|
|
142
|
+
iReckon(sir, dataRenamedIbGib.rel8ns!.past).isGonnaBeTruthy();
|
|
143
|
+
iReckon(sir, (dataRenamedIbGib.rel8ns!.past || []).length)
|
|
144
|
+
.asTo('dataRenamedIbGib.rel8ns!.past || []).length')
|
|
145
|
+
.isGonnaBe(1);
|
|
146
146
|
|
|
147
147
|
// the data should have the new key name that we did
|
|
148
|
-
|
|
148
|
+
iReckon(sir, Object.keys(dataRenamedIbGib.data!)).toContain(newNameForX);
|
|
149
149
|
|
|
150
150
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
151
|
-
|
|
151
|
+
iReckon(sir, dataRenamedIbGib.data![newNameForX]).isGonnaBe(valueForX);
|
|
152
152
|
|
|
153
153
|
// the most recent past of the dataRenamed ibGib should be the src's (dataAddedIbGib) address
|
|
154
|
-
|
|
154
|
+
iReckon(sir, dataRenamedIbGib.rel8ns!.past![dataRenamedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
157
|
|
|
@@ -162,15 +162,15 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
162
162
|
|
|
163
163
|
let { newIbGib: dataPatchedIbGib } =
|
|
164
164
|
await mut8({ src: dataAddedIbGib, dataToAddOrPatch: dataToPatch, noTimestamp: true });
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
iReckon(sir, dataPatchedIbGib).isGonnaBeTruthy();
|
|
166
|
+
iReckon(sir, dataPatchedIbGib.data).isGonnaBeTruthy();
|
|
167
|
+
iReckon(sir, dataPatchedIbGib.data).isGonnaBeTruthy();
|
|
168
168
|
|
|
169
169
|
// value should be changed to the new value
|
|
170
|
-
|
|
170
|
+
iReckon(sir, dataPatchedIbGib.data!.x).isGonnaBe(newValueForX);
|
|
171
171
|
|
|
172
172
|
// the most recent past of the dataRenamed ibGib should be the src's (dataAddedIbGib) address
|
|
173
|
-
|
|
173
|
+
iReckon(sir, dataPatchedIbGib.rel8ns!.past![dataPatchedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
174
174
|
|
|
175
175
|
//#endregion
|
|
176
176
|
|
|
@@ -180,15 +180,15 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
180
180
|
|
|
181
181
|
let { newIbGib: dataRemovedIbGib } =
|
|
182
182
|
await mut8({ src: dataAddedIbGib, dataToRemove, noTimestamp: true });
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
iReckon(sir, dataRemovedIbGib).isGonnaBeTruthy();
|
|
184
|
+
iReckon(sir, dataRemovedIbGib.data).isGonnaBeTruthy();
|
|
185
|
+
iReckon(sir, dataRemovedIbGib.data).isGonnaBeTruthy();
|
|
186
186
|
|
|
187
187
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
188
|
-
|
|
188
|
+
iReckon(sir, dataRemovedIbGib.data!.x).toBeUndefined();
|
|
189
189
|
|
|
190
190
|
// the most recent past of the dataRemovedIbGib should be the src's address
|
|
191
|
-
|
|
191
|
+
iReckon(sir, dataRemovedIbGib.rel8ns!.past![dataRemovedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
192
192
|
|
|
193
193
|
//#endregion
|
|
194
194
|
|
|
@@ -196,14 +196,14 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
196
196
|
|
|
197
197
|
let { newIbGib: ibMut8dIbGib } =
|
|
198
198
|
await mut8({ src: dataAddedIbGib, mut8Ib: NEW_IB, noTimestamp: true });
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
iReckon(sir, ibMut8dIbGib).isGonnaBeTruthy();
|
|
200
|
+
iReckon(sir, ibMut8dIbGib.ib).isGonnaBe(NEW_IB);
|
|
201
201
|
|
|
202
202
|
//#endregion
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
await ifWe(sir, `should be rel8d next mut8`, async () => {
|
|
207
207
|
const { newIbGib: tjpIbGib } = await fork({
|
|
208
208
|
src: primitive,
|
|
209
209
|
destIb: 'some ib yo',
|
|
@@ -211,40 +211,40 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
211
211
|
});
|
|
212
212
|
const tjpAddr = getIbGibAddr({ ibGib: tjpIbGib });
|
|
213
213
|
const tjpAddrGib = getIbAndGib({ ibGibAddr: tjpAddr }).gib;
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
iReckon(sir, tjpIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
215
|
+
iReckon(sir, tjpIbGib!.data?.isTjp).asTo("isTjp").toBeTrue()
|
|
216
216
|
const { newIbGib: hasRel8dTjp } = await mut8({
|
|
217
217
|
src: tjpIbGib,
|
|
218
218
|
dataToAddOrPatch: { someData: "not intrinsically pertinent to this test" },
|
|
219
219
|
});
|
|
220
220
|
const hasRel8dTjpAddr = getIbGibAddr({ ibGib: hasRel8dTjp });
|
|
221
221
|
const hasRel8dTjpAddrGib = getIbAndGib({ ibGibAddr: hasRel8dTjpAddr }).gib;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
iReckon(sir, hasRel8dTjp!.data?.uuid).isGonnaBeTruthy();
|
|
223
|
+
iReckon(sir, hasRel8dTjp!.data?.isTjp).asTo("isTjp after additional mut8").toBeUndefined();
|
|
224
|
+
iReckon(sir, hasRel8dTjp!.rel8ns).asTo("rel8ns").isGonnaBeTruthy();
|
|
225
|
+
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp).asTo("rel8ns.tjp").isGonnaBeTruthy();
|
|
226
|
+
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp!.length).asTo("rel8ns.tjp.length").isGonnaBe(1);
|
|
227
|
+
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp).asTo("rel8ns.tjp include").toContain(tjpAddr);
|
|
228
228
|
|
|
229
229
|
// the gib should not just be the hash, since it has a tjp timeline
|
|
230
|
-
|
|
230
|
+
iReckon(sir, hasRel8dTjpAddrGib).toContain(tjpAddrGib);
|
|
231
231
|
|
|
232
232
|
// shoe-horning in here some getGibInfo testing...eesh
|
|
233
233
|
let hasRel8dTjpGibInfo = getGibInfo({ ibGibAddr: hasRel8dTjpAddr }); // via addr
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
iReckon(sir, hasRel8dTjpGibInfo.isPrimitive).toBeUndefined();
|
|
235
|
+
iReckon(sir, hasRel8dTjpGibInfo.piecesCount).isGonnaBe(2, 'pieces count');
|
|
236
236
|
const hasRel8dTjpHash = await sha256v1(hasRel8dTjp, '');
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
iReckon(sir, hasRel8dTjpGibInfo.punctiliarHash).isGonnaBe(hasRel8dTjpHash, 'punctiliarHash');
|
|
238
|
+
iReckon(sir, hasRel8dTjpGibInfo.tjpGib).isGonnaBe(tjpAddrGib);
|
|
239
239
|
// the info should be the same if we get it straight from the gib
|
|
240
240
|
const hasRel8dTjpGibInfo_viaGib = getGibInfo({ gib: hasRel8dTjpAddrGib }); // via gib
|
|
241
|
-
|
|
241
|
+
iReckon(sir, hasRel8dTjpGibInfo_viaGib).isGonnaBe(hasRel8dTjpGibInfo, 'infos via addr and gib should be equal');
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
} // double for..of statement
|
|
245
245
|
})
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
await respecfully(sir, `...and creating dna`, async () => {
|
|
248
248
|
var src: IbGib_V1, forkDnas: IbGib_V1[],
|
|
249
249
|
// these are used later when reapplying dnas to test pure functionality
|
|
250
250
|
addDna: IbGib_V1, dataAddedIbGib1: IbGib_V1,
|
|
@@ -257,7 +257,7 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
257
257
|
forkDnas = resInit.dnas!;
|
|
258
258
|
})
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
await ifWe(sir, `should have well-formed dna...`, async () => {
|
|
261
261
|
|
|
262
262
|
// #region data added
|
|
263
263
|
|
|
@@ -271,25 +271,25 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
271
271
|
let mut8Dna = Mut8AddDnas![0];
|
|
272
272
|
addDna = mut8Dna;
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
iReckon(sir, mut8Dna.ib).asTo(`ib should be mut8`).isGonnaBe('mut8');
|
|
275
275
|
|
|
276
276
|
{
|
|
277
|
-
|
|
277
|
+
iReckon(sir, mut8Dna?.rel8ns).asTo(`should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
278
278
|
const mut8DnaRel8ns: IbGibRel8ns_V1 = mut8Dna?.rel8ns!;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
iReckon(sir, mut8DnaRel8ns.ancestor).asTo(`should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
280
|
+
iReckon(sir, mut8DnaRel8ns.ancestor!.length).asTo(`should descend from mut8^gib primitive`).isGonnaBe(1);
|
|
281
|
+
iReckon(sir, mut8DnaRel8ns.ancestor![0]).asTo(`should descend from mut8^gib primitive`).isGonnaBe('mut8^gib');
|
|
282
282
|
|
|
283
283
|
const mut8DnaData = (mut8Dna.data as TransformOpts_Mut8<IbGib_V1>)!;
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
iReckon(sir, mut8DnaData).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
286
|
+
iReckon(sir, mut8DnaData).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
287
|
+
iReckon(sir, mut8DnaData.dna).asTo(`should have well-formed common transform opts`).toBeTrue()
|
|
288
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`should have well-formed common transform opts`).toBeUndefined();
|
|
289
|
+
iReckon(sir, mut8DnaData.src).asTo(`should have well-formed common transform opts`).toBeUndefined();
|
|
290
290
|
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
iReckon(sir, mut8DnaData.type).asTo(`should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
292
|
+
iReckon(sir, mut8DnaData.dataToAddOrPatch).asTo(`should have well-formed data specific to type of mut8`).isGonnaBe(dataToAdd);
|
|
293
293
|
}
|
|
294
294
|
// #endregion
|
|
295
295
|
|
|
@@ -304,22 +304,22 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
304
304
|
mut8Dna = patchedDnas![0];
|
|
305
305
|
patchDna = mut8Dna;
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
iReckon(sir, mut8Dna.ib).asTo(`data patched, ib should be mut8`).isGonnaBe('mut8');
|
|
308
|
+
iReckon(sir, mut8Dna?.rel8ns).asTo(`data patched, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
309
309
|
const mut8DnaRel8ns: IbGibRel8ns_V1 = mut8Dna?.rel8ns!;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
iReckon(sir, mut8DnaRel8ns.ancestor).asTo(`data patched, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
311
|
+
iReckon(sir, mut8DnaRel8ns.ancestor!.length).isGonnaBe(1);
|
|
312
|
+
iReckon(sir, mut8DnaRel8ns.ancestor![0]).isGonnaBe('mut8^gib');
|
|
313
313
|
|
|
314
314
|
const mut8DnaData = (mut8Dna.data as TransformOpts_Mut8<IbGib_V1>)!;
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
iReckon(sir, mut8DnaData).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
317
|
+
iReckon(sir, mut8DnaData).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
318
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data patched, should have well-formed common transform opts`).toBeTrue()
|
|
319
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data patched, should have well-formed common transform opts`).toBeUndefined();
|
|
320
|
+
iReckon(sir, mut8DnaData.src).asTo(`data patched, should have well-formed common transform opts`).toBeUndefined();
|
|
321
|
+
iReckon(sir, mut8DnaData.type).asTo(`data patched, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
322
|
+
iReckon(sir, mut8DnaData.dataToAddOrPatch).asTo(`data patched, should have well-formed data specific to type of mut8`).isGonnaBe(dataToPatch);
|
|
323
323
|
}
|
|
324
324
|
// #endregion
|
|
325
325
|
|
|
@@ -333,23 +333,23 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
333
333
|
mut8Dna = renamedDnas![0];
|
|
334
334
|
renameDna = mut8Dna;
|
|
335
335
|
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
iReckon(sir, mut8Dna.ib).asTo(`data renamed, ib should be mut8`).isGonnaBe('mut8');
|
|
337
|
+
iReckon(sir, mut8Dna?.rel8ns).asTo(`data renamed, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
338
338
|
const mut8DnaRel8ns: IbGibRel8ns_V1 = mut8Dna?.rel8ns!;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
iReckon(sir, mut8DnaRel8ns.ancestor).asTo(`data renamed, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
340
|
+
iReckon(sir, mut8DnaRel8ns.ancestor!.length).asTo(`data renamed, should descend from mut8^gib primitive`).isGonnaBe(1);
|
|
341
|
+
iReckon(sir, mut8DnaRel8ns.ancestor![0]).asTo(`data renamed, should descend from mut8^gib primitive`).isGonnaBe('mut8^gib');
|
|
342
342
|
|
|
343
343
|
const mut8DnaData = (mut8Dna.data as TransformOpts_Mut8<IbGib_V1>)!;
|
|
344
344
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
iReckon(sir, mut8DnaData).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
346
|
+
iReckon(sir, mut8DnaData).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
347
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data renamed, should have well-formed common transform opts`).toBeTrue()
|
|
348
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data renamed, should have well-formed common transform opts`).toBeUndefined();
|
|
349
|
+
iReckon(sir, mut8DnaData.src).asTo(`data renamed, should have well-formed common transform opts`).toBeUndefined();
|
|
350
350
|
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
iReckon(sir, mut8DnaData.type).asTo(`data renamed, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
352
|
+
iReckon(sir, mut8DnaData.dataToRename).asTo(`data renamed, should have well-formed data specific to type of mut8`).isGonnaBe(dataToRename);
|
|
353
353
|
}
|
|
354
354
|
// #endregion
|
|
355
355
|
|
|
@@ -364,23 +364,23 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
364
364
|
mut8Dna = removedDnas![0];
|
|
365
365
|
removeDna = mut8Dna;
|
|
366
366
|
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
iReckon(sir, mut8Dna.ib).asTo(`data removed, ib should be mut8`).isGonnaBe('mut8');
|
|
368
|
+
iReckon(sir, mut8Dna?.rel8ns).asTo(`data removed, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
369
369
|
const mut8DnaRel8ns: IbGibRel8ns_V1 = mut8Dna?.rel8ns!;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
iReckon(sir, mut8DnaRel8ns.ancestor).asTo(`data removed, should descend from mut8^gib primitive`).isGonnaBeTruthy();
|
|
371
|
+
iReckon(sir, mut8DnaRel8ns.ancestor!.length).asTo(`data removed, should descend from mut8^gib primitive`).isGonnaBe(1);
|
|
372
|
+
iReckon(sir, mut8DnaRel8ns.ancestor![0]).asTo(`data removed, should descend from mut8^gib primitive`).isGonnaBe('mut8^gib');
|
|
373
373
|
|
|
374
374
|
const mut8DnaData = (mut8Dna.data as TransformOpts_Mut8<IbGib_V1>)!;
|
|
375
375
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
376
|
+
iReckon(sir, mut8DnaData).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
377
|
+
iReckon(sir, mut8DnaData).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
378
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data removed, should have well-formed common transform opts`).toBeTrue()
|
|
379
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data removed, should have well-formed common transform opts`).toBeUndefined();
|
|
380
|
+
iReckon(sir, mut8DnaData.src).asTo(`data removed, should have well-formed common transform opts`).toBeUndefined();
|
|
381
381
|
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
iReckon(sir, mut8DnaData.type).asTo(`data removed, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
383
|
+
iReckon(sir, mut8DnaData.dataToRemove).asTo(`data removed, should have well-formed data specific to type of mut8`).isGonnaBe(dataToRemove);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
// #endregion
|
|
@@ -405,64 +405,64 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
405
405
|
const optsClone: TransformOpts_Mut8<IbGib_V1> = clone(addDna!.data);
|
|
406
406
|
optsClone.src = src;
|
|
407
407
|
const { newIbGib: newIbGib2, dnas: dnas2 } = await mut8(optsClone);
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
iReckon(sir, newIbGib2).asTo(`should be pure add mutation (expect delay)`).isGonnaBeTruthy();
|
|
409
|
+
iReckon(sir, dnas2).asTo(`should be pure add mutation (expect delay)`).isGonnaBeTruthy();
|
|
410
410
|
const dna2 = dnas2![0];
|
|
411
411
|
|
|
412
412
|
// dna itself should be exactly the same
|
|
413
|
-
|
|
413
|
+
iReckon(sir, dna2).asTo(`should be pure add mutation (expect delay)`).isGonnaBe(addDna);
|
|
414
414
|
|
|
415
415
|
// the ibGibs **created** should NOT be the same because of timestamping
|
|
416
416
|
// (and later on, other factors would change like identity and other rel8ns)
|
|
417
|
-
|
|
417
|
+
iReckon(sir, newIbGib2.gib).asTo(`should be pure add mutation (expect delay)`).not.isGonnaBe(dataAddedIbGib1.gib);
|
|
418
418
|
}
|
|
419
419
|
{
|
|
420
420
|
await delay(500);
|
|
421
421
|
const optsClone: TransformOpts_Mut8<IbGib_V1> = clone(patchDna!.data);
|
|
422
422
|
optsClone.src = dataAddedIbGib1;
|
|
423
423
|
const { newIbGib: newIbGib2, dnas: dnas2 } = await mut8(optsClone);
|
|
424
|
-
|
|
425
|
-
|
|
424
|
+
iReckon(sir, newIbGib2).asTo(`should be pure patch mutation (expect delay)`).isGonnaBeTruthy();
|
|
425
|
+
iReckon(sir, dnas2).asTo(`should be pure patch mutation (expect delay)`).isGonnaBeTruthy();
|
|
426
426
|
const dna2 = dnas2![0];
|
|
427
427
|
|
|
428
428
|
// dna itself should be exactly the same
|
|
429
|
-
|
|
429
|
+
iReckon(sir, dna2).asTo(`should be pure patch mutation (expect delay)`).isGonnaBe(patchDna);
|
|
430
430
|
|
|
431
431
|
// the ibGibs **created** should NOT be the same because of timestamping
|
|
432
432
|
// (and later on, other factors would change like identity and other rel8ns)
|
|
433
|
-
|
|
433
|
+
iReckon(sir, newIbGib2.gib).asTo(`should be pure patch mutation (expect delay)`).not.isGonnaBe(dataPatchedIbGib1.gib);
|
|
434
434
|
}
|
|
435
435
|
{
|
|
436
436
|
await delay(500);
|
|
437
437
|
const optsClone: TransformOpts_Mut8<IbGib_V1> = clone(renameDna!.data);
|
|
438
438
|
optsClone.src = dataAddedIbGib1;
|
|
439
439
|
const { newIbGib: newIbGib2, dnas: dnas2 } = await mut8(optsClone);
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
iReckon(sir, newIbGib2).asTo(`should be pure rename mutation (expect delay)`).isGonnaBeTruthy();
|
|
441
|
+
iReckon(sir, dnas2).asTo(`should be pure rename mutation (expect delay)`).isGonnaBeTruthy();
|
|
442
442
|
const dna2 = dnas2![0];
|
|
443
443
|
|
|
444
444
|
// dna itself should be exactly the same
|
|
445
|
-
|
|
445
|
+
iReckon(sir, dna2).asTo(`should be pure rename mutation (expect delay)`).isGonnaBe(renameDna);
|
|
446
446
|
|
|
447
447
|
// the ibGibs **created** should NOT be the same because of timestamping
|
|
448
448
|
// (and later on, other factors would change like identity and other rel8ns)
|
|
449
|
-
|
|
449
|
+
iReckon(sir, newIbGib2.gib).asTo(`should be pure rename mutation (expect delay)`).not.isGonnaBe(dataRenamedIbGib1.gib);
|
|
450
450
|
}
|
|
451
451
|
{
|
|
452
452
|
await delay(500);
|
|
453
453
|
const optsClone: TransformOpts_Mut8<IbGib_V1> = clone(removeDna!.data);
|
|
454
454
|
optsClone.src = dataAddedIbGib1;
|
|
455
455
|
const { newIbGib: newIbGib2, dnas: dnas2 } = await mut8(optsClone);
|
|
456
|
-
|
|
457
|
-
|
|
456
|
+
iReckon(sir, newIbGib2).asTo(`should be pure remove mutation (expect delay)`).isGonnaBeTruthy();
|
|
457
|
+
iReckon(sir, dnas2).asTo(`should be pure remove mutation (expect delay)`).isGonnaBeTruthy();
|
|
458
458
|
const dna2 = dnas2![0];
|
|
459
459
|
|
|
460
460
|
// dna itself should be exactly the same
|
|
461
|
-
|
|
461
|
+
iReckon(sir, dna2).asTo(`should be pure remove mutation (expect delay)`).isGonnaBe(removeDna);
|
|
462
462
|
|
|
463
463
|
// the ibGibs **created** should NOT be the same because of timestamping
|
|
464
464
|
// (and later on, other factors would change like identity and other rel8ns)
|
|
465
|
-
|
|
465
|
+
iReckon(sir, newIbGib2.gib).asTo(`should be pure remove mutation (expect delay)`).not.isGonnaBe(dataRemovedIbGib1.gib);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
// #endregion
|
|
@@ -470,9 +470,9 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
470
470
|
|
|
471
471
|
}); // dna
|
|
472
472
|
|
|
473
|
-
|
|
473
|
+
await respecfully(sir, `with more complex data`, async () => {
|
|
474
474
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
475
|
-
|
|
475
|
+
await ifWe(sir, `should add/rename/patch (${primitive.ib})`, async () => {
|
|
476
476
|
|
|
477
477
|
let { newIbGib: src } = await fork({ src: primitive, noTimestamp: true });
|
|
478
478
|
|
|
@@ -487,10 +487,10 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
487
487
|
noTimestamp: true
|
|
488
488
|
});
|
|
489
489
|
let dataAddedAddr: IbGibAddr = getIbGibAddr({ ibGib: dataAddedIbGib });
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
490
|
+
iReckon(sir, dataAddedIbGib).isGonnaBeTruthy();
|
|
491
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBeTruthy();
|
|
492
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBeTruthy();
|
|
493
|
+
iReckon(sir, dataAddedIbGib.data).isGonnaBe(DATA_COMPLEX_XY_NESTED);
|
|
494
494
|
|
|
495
495
|
// #endregion
|
|
496
496
|
|
|
@@ -505,20 +505,20 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
505
505
|
let { newIbGib: dataRenamedIbGib } =
|
|
506
506
|
await mut8({ src: dataAddedIbGib, dataToRename, noTimestamp: true });
|
|
507
507
|
// let dataRenamedAddr: IbGibAddr = getIbGibAddr({ibGib: dataRenamedIbGib});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
508
|
+
iReckon(sir, dataRenamedIbGib).isGonnaBeTruthy();
|
|
509
|
+
iReckon(sir, dataRenamedIbGib.data).isGonnaBeTruthy();
|
|
510
|
+
iReckon(sir, dataRenamedIbGib.data).isGonnaBeTruthy();
|
|
511
511
|
|
|
512
512
|
// the data should have the new key name that we did
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
iReckon(sir, dataRenamedIbGib.data!.nested1).isGonnaBeTruthy();
|
|
514
|
+
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAME_ME_KEY]).toBeUndefined();
|
|
515
|
+
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAMED_KEY]).isGonnaBeTruthy();
|
|
516
516
|
|
|
517
517
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
518
|
-
|
|
518
|
+
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAMED_KEY]).isGonnaBe(RENAME_VALUE);
|
|
519
519
|
|
|
520
520
|
// the most recent past of the dataRenamed ibGib should be the src's (dataAddedIbGib) address
|
|
521
|
-
|
|
521
|
+
iReckon(sir, dataRenamedIbGib.rel8ns!.past![dataRenamedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
522
522
|
|
|
523
523
|
//#endregion
|
|
524
524
|
|
|
@@ -529,16 +529,16 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
529
529
|
|
|
530
530
|
let { newIbGib: dataPatchedIbGib } =
|
|
531
531
|
await mut8({ src: dataAddedIbGib, dataToAddOrPatch: dataToPatch, noTimestamp: true });
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
532
|
+
iReckon(sir, dataPatchedIbGib).isGonnaBeTruthy();
|
|
533
|
+
iReckon(sir, dataPatchedIbGib.data).isGonnaBeTruthy();
|
|
534
|
+
iReckon(sir, dataPatchedIbGib.data).isGonnaBeTruthy();
|
|
535
|
+
iReckon(sir, dataPatchedIbGib.data!.xyObj).isGonnaBeTruthy();
|
|
536
536
|
|
|
537
537
|
// value should be changed to the new value
|
|
538
|
-
|
|
538
|
+
iReckon(sir, dataPatchedIbGib.data!.xyObj!.x).isGonnaBe(newValueForX);
|
|
539
539
|
|
|
540
540
|
// the most recent past of the dataRenamed ibGib should be the src's (dataAddedIbGib) address
|
|
541
|
-
|
|
541
|
+
iReckon(sir, dataPatchedIbGib.rel8ns!.past![dataPatchedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
542
542
|
|
|
543
543
|
//#endregion
|
|
544
544
|
|
|
@@ -548,31 +548,31 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
548
548
|
|
|
549
549
|
let { newIbGib: dataRemovedIbGib } =
|
|
550
550
|
await mut8({ src: dataAddedIbGib, dataToRemove, noTimestamp: true });
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
551
|
+
iReckon(sir, dataRemovedIbGib).isGonnaBeTruthy();
|
|
552
|
+
iReckon(sir, dataRemovedIbGib.data).isGonnaBeTruthy();
|
|
553
|
+
iReckon(sir, dataRemovedIbGib.data).isGonnaBeTruthy();
|
|
554
554
|
|
|
555
555
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
556
|
-
|
|
557
|
-
|
|
556
|
+
iReckon(sir, dataRemovedIbGib.data!.xyObj).isGonnaBeTruthy();
|
|
557
|
+
iReckon(sir, dataRemovedIbGib.data!.xyObj!.x).toBeUndefined();
|
|
558
558
|
|
|
559
559
|
// the most recent past of the dataRemovedIbGib should be the src's address
|
|
560
|
-
|
|
560
|
+
iReckon(sir, dataRemovedIbGib.rel8ns!.past![dataRemovedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
561
561
|
|
|
562
562
|
//#endregion
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
})
|
|
566
566
|
|
|
567
|
-
|
|
568
|
-
|
|
567
|
+
await respecfully(sir, `nCounter`, async () => {
|
|
568
|
+
await ifWe(sir, `should increment existing n counter`, async () => {
|
|
569
569
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
570
570
|
let { newIbGib: src_0 } =
|
|
571
571
|
await fork({ src: primitive, nCounter: true });
|
|
572
572
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
iReckon(sir, src_0.data).isGonnaBeTruthy();
|
|
574
|
+
iReckon(sir, src_0.data).isGonnaBeTruthy();
|
|
575
|
+
iReckon(sir, src_0.data!.n).isGonnaBe(0);
|
|
576
576
|
|
|
577
577
|
let { newIbGib: src_1 } =
|
|
578
578
|
await mut8({
|
|
@@ -580,19 +580,19 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
580
580
|
dataToAddOrPatch: DATA_SIMPLE_XY,
|
|
581
581
|
nCounter: true
|
|
582
582
|
});
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
583
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
584
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
585
|
+
iReckon(sir, src_1.data!.n).isGonnaBeTruthy();
|
|
586
|
+
iReckon(sir, src_1.data!.n).isGonnaBeTruthy();
|
|
587
|
+
iReckon(sir, src_1.data!.n).isGonnaBe(1);
|
|
588
588
|
}
|
|
589
589
|
});
|
|
590
|
-
|
|
590
|
+
await ifWe(sir, `should start new n counter, implicit nCounter falsy`, async () => {
|
|
591
591
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
592
592
|
let { newIbGib: src_0 } =
|
|
593
593
|
await fork({ src: primitive, noTimestamp: true });
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
iReckon(sir, src_0.data).toBeUndefined();
|
|
596
596
|
|
|
597
597
|
let { newIbGib: src_1 } =
|
|
598
598
|
await mut8({
|
|
@@ -600,17 +600,17 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
600
600
|
dataToAddOrPatch: DATA_SIMPLE_XY,
|
|
601
601
|
nCounter: true
|
|
602
602
|
});
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
604
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
605
|
+
iReckon(sir, src_1.data!.n).isGonnaBe(0);
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
|
-
|
|
608
|
+
await ifWe(sir, `should start new n counter, explicit nCounter falsy`, async () => {
|
|
609
609
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
610
610
|
let { newIbGib: src_0 } =
|
|
611
611
|
await fork({ src: primitive, noTimestamp: true, nCounter: false });
|
|
612
612
|
|
|
613
|
-
|
|
613
|
+
iReckon(sir, src_0.data).toBeUndefined();
|
|
614
614
|
|
|
615
615
|
let { newIbGib: src_1 } =
|
|
616
616
|
await mut8({
|
|
@@ -618,15 +618,15 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
618
618
|
dataToAddOrPatch: DATA_SIMPLE_XY,
|
|
619
619
|
nCounter: true
|
|
620
620
|
});
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
622
|
+
iReckon(sir, src_1.data).isGonnaBeTruthy();
|
|
623
|
+
iReckon(sir, src_1.data!.n).isGonnaBe(0);
|
|
624
624
|
}
|
|
625
625
|
});
|
|
626
626
|
});
|
|
627
627
|
|
|
628
|
-
|
|
629
|
-
|
|
628
|
+
await respecfully(sir, `when mut8 with dna`, async () => {
|
|
629
|
+
await ifWe(sir, `should have gibs that is corroborated with getGib`, async () => {
|
|
630
630
|
for (const primitive of PRIMITIVE_IBGIBS) {
|
|
631
631
|
let { newIbGib, intermediateIbGibs, dnas } =
|
|
632
632
|
await fork({ src: primitive, nCounter: false, dna: true });
|
|
@@ -649,7 +649,7 @@ describe(`when mutating a regular ibgib`, () => {
|
|
|
649
649
|
for (let i = 0; i < ibGibs.length; i++) {
|
|
650
650
|
const ibGib = ibGibs[i];
|
|
651
651
|
const gottenGib = await getGib({ ibGib });
|
|
652
|
-
|
|
652
|
+
iReckon(sir, ibGib.gib).isGonnaBe(gottenGib);
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
});
|