@ibgib/ts-gib 0.5.0 → 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 +8 -0
- package/README.md +22 -3
- package/dist/V1/transforms/index.d.mts +1 -1
- package/dist/V1/transforms/index.d.mts.map +1 -1
- package/dist/V1/transforms/index.mjs +1 -1
- package/dist/V1/transforms/index.mjs.map +1 -1
- 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/index.mts +1 -1
- 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
|
@@ -25,31 +25,31 @@ import { ROOT, ROOT_ADDR } from '../constants.mjs';
|
|
|
25
25
|
import { mut8 } from './mut8.mjs';
|
|
26
26
|
import { getGib } from './transform-helper.mjs';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
await respecfully(sir, `when forking the root`, async () => {
|
|
29
29
|
|
|
30
30
|
const src = ROOT;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
await ifWe(sir, `should create a new ibgib`, async () => {
|
|
33
33
|
const { newIbGib } = await fork({ src });
|
|
34
|
-
|
|
34
|
+
iReckon(sir, newIbGib).isGonnaBeTruthy();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
await ifWe(sir, `should have no rel8ns (because forked from the root)`, async () => {
|
|
38
38
|
const { newIbGib } = await fork({ src });
|
|
39
|
-
|
|
39
|
+
iReckon(sir, newIbGib.rel8ns).toBeUndefined();
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
await respecfully(sir, `should respect param`, async () => {
|
|
43
|
+
await ifWe(sir, `noTimestamp`, async () => {
|
|
44
44
|
const { newIbGib } = await fork({ src, noTimestamp: true });
|
|
45
45
|
if (newIbGib?.data) {
|
|
46
|
-
|
|
46
|
+
iReckon(sir, newIbGib.data!.timestamp).toBeUndefined();
|
|
47
47
|
} else {
|
|
48
48
|
// data being falsy is passing so no expect statement needed
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
await ifWe(sir, `destIb`, async () => {
|
|
53
53
|
// just an example, ib can be any value/metadata per use case
|
|
54
54
|
// in this example, we have a canonical form tag [tagName]
|
|
55
55
|
// this way, we can just pass around the address (tag like ^ABCD123)
|
|
@@ -57,103 +57,103 @@ describe(`when forking the root`, () => {
|
|
|
57
57
|
// entire data record.
|
|
58
58
|
const destIb = 'tag like';
|
|
59
59
|
const { newIbGib } = await fork({ src, destIb });
|
|
60
|
-
|
|
60
|
+
iReckon(sir, newIbGib.ib).isGonnaBe(destIb);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
await ifWe(sir, `dna`, async () => {
|
|
64
64
|
// NOTE: more extensive dna testing is below in other tests
|
|
65
65
|
const destIb = "This will be the new ib";
|
|
66
66
|
const { newIbGib, dnas } = await fork({ src, dna: true, destIb });
|
|
67
|
-
|
|
67
|
+
iReckon(sir, dnas).isGonnaBeTruthy();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
await ifWe(sir, `uuid`, async () => {
|
|
71
71
|
const { newIbGib } = await fork({ src, uuid: true });
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
73
|
+
iReckon(sir, newIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
await respecfully(sir, `tjp...`, async () => {
|
|
77
|
+
await ifWe(sir, `timestamp`, async () => {
|
|
78
78
|
const { newIbGib } = await fork({ src, tjp: { timestamp: true } });
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
80
|
+
iReckon(sir, newIbGib!.data?.timestamp).isGonnaBeTruthy();
|
|
81
81
|
const testDate = new Date(newIbGib!.data!.timestamp!);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
iReckon(sir, testDate).isGonnaBeTruthy();
|
|
83
|
+
iReckon(sir, testDate).isGonnaBeTruthy();
|
|
84
|
+
iReckon(sir, testDate.toString()).not.isGonnaBe("Invalid Date");
|
|
85
85
|
// counting on environment (node) to be consistent with invalid dates in the future
|
|
86
86
|
const invalidDate = new Date("asdf");
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
iReckon(sir, invalidDate.toString()).isGonnaBe("Invalid Date");
|
|
88
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").toBeTrue();
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
await ifWe(sir, `uuid`, async () => {
|
|
91
91
|
const { newIbGib } = await fork({ src, tjp: { uuid: true } });
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
93
|
+
iReckon(sir, newIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
94
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").toBeTrue()
|
|
95
95
|
});
|
|
96
|
-
|
|
96
|
+
await ifWe(sir, `timestamp && uuid`, async () => {
|
|
97
97
|
const { newIbGib } = await fork({ src, tjp: { timestamp: true, uuid: true } });
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
99
|
+
iReckon(sir, newIbGib!.data?.timestamp).isGonnaBeTruthy();
|
|
100
100
|
const testDate = new Date(newIbGib!.data!.timestamp!);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
iReckon(sir, testDate).isGonnaBeTruthy();
|
|
102
|
+
iReckon(sir, testDate).isGonnaBeTruthy();
|
|
103
|
+
iReckon(sir, testDate.toString()).not.isGonnaBe("Invalid Date");
|
|
104
|
+
iReckon(sir, newIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
105
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").toBeTrue()
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
await ifWe(sir, `nCounter`, async () => {
|
|
110
110
|
const { newIbGib } = await fork({ src, nCounter: true });
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
112
|
+
iReckon(sir, newIbGib!.data?.n).isGonnaBe(0);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
await ifWe(sir, `cloneRel8ns (setting should be ignored since forking root)`, async () => {
|
|
117
117
|
const { newIbGib } = await fork({ src, cloneRel8ns: true, noTimestamp: true });
|
|
118
|
-
|
|
118
|
+
iReckon(sir, newIbGib?.rel8ns).toBeUndefined();
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
await ifWe(sir, `cloneData (setting should be ignored since forking root)`, async () => {
|
|
122
122
|
const { newIbGib } = await fork({ src, cloneData: true, noTimestamp: true });
|
|
123
|
-
|
|
123
|
+
iReckon(sir, newIbGib?.data).toBeUndefined();
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
await respecfully(sir, `...and creating dna`, async () => {
|
|
128
|
+
await ifWe(sir, `should have well-formed dna, like...`, async () => {
|
|
129
129
|
const destIb = "This will be the new ib";
|
|
130
130
|
const { newIbGib, intermediateIbGibs, dnas } = await fork({ src, dna: true, destIb });
|
|
131
131
|
const forkDna = dnas![0];
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
iReckon(sir, forkDna.ib).asTo(`ib should be fork`).isGonnaBe('fork');
|
|
134
134
|
|
|
135
135
|
let ibGibs = [newIbGib, ...(intermediateIbGibs ?? []), ...(dnas ?? [])];
|
|
136
136
|
for (let i = 0; i < ibGibs.length; i++) {
|
|
137
137
|
const ibGib = ibGibs[i];
|
|
138
138
|
let gottenGib = await getGib({ ibGib });
|
|
139
|
-
|
|
139
|
+
iReckon(sir, ibGib.gib).asTo(`should have a gib that is corroborated with getGib`).isGonnaBe(gottenGib);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
iReckon(sir, forkDna?.rel8ns).asTo(`should descend from fork^gib primitive`).isGonnaBeTruthy();
|
|
143
143
|
const forkDnaRel8ns: IbGibRel8ns_V1 = forkDna?.rel8ns!;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
iReckon(sir, forkDnaRel8ns.ancestor).asTo(`should descend from fork^gib primitive`).isGonnaBeTruthy();
|
|
145
|
+
iReckon(sir, forkDnaRel8ns.ancestor!.length).asTo(`should descend from fork^gib primitive`).isGonnaBe(1);
|
|
146
|
+
iReckon(sir, forkDnaRel8ns.ancestor![0]).asTo(`should descend from fork^gib primitive`).isGonnaBe('fork^gib');
|
|
147
147
|
|
|
148
148
|
const forkDnaData = (forkDna.data as TransformOpts_Fork<IbGib_V1>)!;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
iReckon(sir, forkDna.data).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
151
|
+
iReckon(sir, forkDnaData.dna).asTo(`should have well-formed common transform opts`).toBeTrue()
|
|
152
|
+
iReckon(sir, forkDnaData.srcAddr).asTo(`should have well-formed common transform opts`).toBeUndefined();
|
|
153
|
+
iReckon(sir, forkDnaData.src).asTo(`should have well-formed common transform opts`).toBeUndefined();
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
iReckon(sir, forkDnaData.type).asTo(`should have well-formed data specific to fork transform`).isGonnaBe("fork");
|
|
156
|
+
iReckon(sir, forkDnaData.destIb).asTo(`should have well-formed data specific to fork transform`).isGonnaBe(destIb);
|
|
157
157
|
|
|
158
158
|
// we're going to do another fork with the same options gotten from the dna
|
|
159
159
|
// (kinda like translating a foreign language translation back into the
|
|
@@ -170,26 +170,26 @@ describe(`when forking the root`, () => {
|
|
|
170
170
|
const forkOpts2: TransformOpts_Fork<IbGib_V1> = clone(forkDnaData);
|
|
171
171
|
forkOpts2.src = ROOT;
|
|
172
172
|
const { newIbGib: newIbGib2, dnas: dnas2 } = await fork(forkOpts2);
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
iReckon(sir, newIbGib2).asTo(`should produce pure dna function, and non-unique dna (without timestamps, tjp, or uuid) (1s delay)`).isGonnaBeTruthy();
|
|
174
|
+
iReckon(sir, dnas2).asTo(`should produce pure dna function, and non-unique dna (without timestamps, tjp, or uuid) (1s delay)`).isGonnaBeTruthy();
|
|
175
175
|
const forkDna2 = dnas2![0];
|
|
176
176
|
|
|
177
177
|
// dna itself should be exactly the same
|
|
178
|
-
|
|
178
|
+
iReckon(sir, forkDna2).asTo(`should produce pure dna function, and non-unique dna (without timestamps, tjp, or uuid) (1s delay)`).isGonnaBe(forkDna);
|
|
179
179
|
|
|
180
180
|
// the ibGibs **created** should NOT be the same because of timestamping
|
|
181
181
|
// (and later on, other factors would change like identity and other rel8ns)
|
|
182
|
-
|
|
182
|
+
iReckon(sir, newIbGib2.gib).asTo(`should produce pure dna function, and non-unique dna (without timestamps, tjp, or uuid) (1s delay)`).not.isGonnaBe(newIbGib.gib);
|
|
183
183
|
|
|
184
184
|
// when forking using the same options, the ib should be the same
|
|
185
|
-
|
|
185
|
+
iReckon(sir, newIbGib2.ib).asTo(`should produce pure dna function, and non-unique dna (without timestamps, tjp, or uuid) (1s delay)`).isGonnaBe(newIbGib.ib);
|
|
186
186
|
});
|
|
187
187
|
}); // dna
|
|
188
188
|
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
await respecfully(sir, `when forking a regular ibgib`, async () => {
|
|
193
193
|
|
|
194
194
|
let src: IbGib_V1;
|
|
195
195
|
let srcAddr: IbGibAddr;
|
|
@@ -199,23 +199,23 @@ describe(`when forking a regular ibgib`, () => {
|
|
|
199
199
|
const beforeResult = await fork({ src: ROOT, uuid: true });
|
|
200
200
|
src = beforeResult.newIbGib;
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
iReckon(sir, src).isGonnaBeTruthy();
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
await ifWe(sir, `should create a new ibgib`, async () => {
|
|
206
206
|
const { newIbGib } = await fork({ src });
|
|
207
|
-
|
|
207
|
+
iReckon(sir, newIbGib).isGonnaBeTruthy();
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
await ifWe(sir, `should have src ib^gib address in ancestor rel8n`, async () => {
|
|
211
211
|
const { newIbGib } = await fork({ src });
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
213
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
214
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
215
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
216
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor!.length).isGonnaBe(1);
|
|
217
217
|
srcAddr = getIbGibAddr({ ibGib: src });
|
|
218
|
-
|
|
218
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor![0]).isGonnaBe(srcAddr);
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
// TODO: TEST FORK cloneRel8ns option ONCE REL8 IS IMPLEMENTED
|
|
@@ -225,18 +225,18 @@ describe(`when forking a regular ibgib`, () => {
|
|
|
225
225
|
// const { newIbGib: parent } = await mut8({ src: grandparent, dataToAddOrPatch: testData });
|
|
226
226
|
// const { newIbGib } = await fork({ src: parent, cloneData: true});
|
|
227
227
|
|
|
228
|
-
// expect(newIbGib).
|
|
229
|
-
// expect(newIbGib!.rel8ns).
|
|
230
|
-
// expect(newIbGib!.rel8ns).
|
|
231
|
-
// expect(newIbGib!.rel8ns!.ancestor).
|
|
232
|
-
// expect(newIbGib!.rel8ns!.ancestor).
|
|
228
|
+
// expect(newIbGib).isGonnaBeTruthy();
|
|
229
|
+
// expect(newIbGib!.rel8ns).isGonnaBeTruthy();
|
|
230
|
+
// expect(newIbGib!.rel8ns).isGonnaBeTruthy();
|
|
231
|
+
// expect(newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
232
|
+
// expect(newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
233
233
|
// const parentAddr = getIbGibAddr({ibGib: parent});
|
|
234
|
-
// expect(newIbGib!.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length-1]).
|
|
235
|
-
// expect(newIbGib!.data).
|
|
236
|
-
// expect(newIbGib!.data).
|
|
234
|
+
// expect(newIbGib!.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length-1]).isGonnaBe(parentAddr);
|
|
235
|
+
// expect(newIbGib!.data).isGonnaBeTruthy();
|
|
236
|
+
// expect(newIbGib!.data).isGonnaBe(testData);
|
|
237
237
|
// });
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
await ifWe(sir, `cloneData`, async () => {
|
|
240
240
|
// adding uuid/timestamp for testing hack
|
|
241
241
|
// need to reconsider inability to rename/remove timestamp data
|
|
242
242
|
// seems silly since bad actors can always do this and security is
|
|
@@ -253,22 +253,22 @@ describe(`when forking a regular ibgib`, () => {
|
|
|
253
253
|
});
|
|
254
254
|
const { newIbGib } = await fork({ src: parent, cloneData: true, noTimestamp: true });
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
iReckon(sir, newIbGib).isGonnaBeTruthy();
|
|
257
|
+
iReckon(sir, newIbGib!.rel8ns).isGonnaBeTruthy();
|
|
258
|
+
iReckon(sir, newIbGib!.rel8ns).isGonnaBeTruthy();
|
|
259
|
+
iReckon(sir, newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
260
|
+
iReckon(sir, newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
261
261
|
const parentAddr = getIbGibAddr({ ibGib: parent });
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
iReckon(sir, newIbGib!.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length - 1]).isGonnaBe(parentAddr);
|
|
263
|
+
iReckon(sir, newIbGib!.data).isGonnaBeTruthy();
|
|
264
|
+
iReckon(sir, newIbGib!.data).isGonnaBe(testData);
|
|
265
265
|
});
|
|
266
266
|
|
|
267
267
|
// it(`should clone data`, async () => {
|
|
268
268
|
// });
|
|
269
269
|
});
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
await respecfully(sir, `when forking multiple regular ibgibs, NON LINKED REL8NS`, async () => {
|
|
272
272
|
|
|
273
273
|
const ibs: Ib[] = ["a", "b", "c", "d"];
|
|
274
274
|
let srcForks: { [ib: string]: TransformResult<IbGib_V1> } = {};
|
|
@@ -290,16 +290,16 @@ describe(`when forking multiple regular ibgibs, NON LINKED REL8NS`, () => {
|
|
|
290
290
|
srcIbGibs = {};
|
|
291
291
|
})
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
await ifWe(sir, `should create a new ibgib`, async () => {
|
|
294
294
|
ibs.forEach(ib => {
|
|
295
295
|
const ibGib = srcIbGibs[ib];
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
iReckon(sir, ibGib).isGonnaBeTruthy();
|
|
297
|
+
iReckon(sir, ibGib).isGonnaBeTruthy();
|
|
298
|
+
iReckon(sir, ibGib.ib).isGonnaBe(ib);
|
|
299
299
|
})
|
|
300
300
|
});
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
await ifWe(sir, `should have src ib^gib (address) in ancestor rel8n`, async () => {
|
|
303
303
|
const getPrev: (ib: Ib) => IbGib_V1 | null = (ib) => {
|
|
304
304
|
switch (ib) {
|
|
305
305
|
case "a": return null;
|
|
@@ -313,13 +313,13 @@ describe(`when forking multiple regular ibgibs, NON LINKED REL8NS`, () => {
|
|
|
313
313
|
ibs.filter(ib => ib !== "a").forEach(ib => {
|
|
314
314
|
const newIbGib = srcIbGibs[ib]!;
|
|
315
315
|
const prevIbGib = getPrev(ib)!;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
317
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
318
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
319
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
320
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor!.length).toBeGreaterThan(0);
|
|
321
321
|
const prevIbGibAddr = getIbGibAddr({ ibGib: prevIbGib });
|
|
322
|
-
|
|
322
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length - 1]).isGonnaBe(prevIbGibAddr);
|
|
323
323
|
})
|
|
324
324
|
});
|
|
325
325
|
|
|
@@ -328,17 +328,17 @@ describe(`when forking multiple regular ibgibs, NON LINKED REL8NS`, () => {
|
|
|
328
328
|
// throw new Error('not implemented yet');
|
|
329
329
|
// const testData = { yo: "there" }
|
|
330
330
|
// const { newIbGib } = await fork({ src });
|
|
331
|
-
// expect(newIbGib?.rel8ns).
|
|
332
|
-
// expect(newIbGib?.rel8ns).
|
|
333
|
-
// expect(newIbGib?.rel8ns!.ancestor).
|
|
334
|
-
// expect(newIbGib?.rel8ns!.ancestor).
|
|
335
|
-
// expect(newIbGib?.rel8ns!.ancestor!.length).
|
|
331
|
+
// expect(newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
332
|
+
// expect(newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
333
|
+
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
334
|
+
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
335
|
+
// expect(newIbGib?.rel8ns!.ancestor!.length).isGonnaBe(1);
|
|
336
336
|
// srcAddr = getIbGibAddr({ibGib: src});
|
|
337
|
-
// expect(newIbGib?.rel8ns!.ancestor![0]).
|
|
337
|
+
// expect(newIbGib?.rel8ns!.ancestor![0]).isGonnaBe(srcAddr);
|
|
338
338
|
// });
|
|
339
339
|
});
|
|
340
340
|
|
|
341
|
-
|
|
341
|
+
await respecfully(sir, `when forking with YES LINKED 'ancestor' rel8n...`, async () => {
|
|
342
342
|
|
|
343
343
|
const ibs: Ib[] = ["a", "b", "c", "d"];
|
|
344
344
|
let srcForks: { [ib: string]: TransformResult<IbGib_V1> } = {};
|
|
@@ -366,16 +366,16 @@ describe(`when forking with YES LINKED 'ancestor' rel8n...`, () => {
|
|
|
366
366
|
srcIbGibs = {};
|
|
367
367
|
})
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
await ifWe(sir, `should create a new ibgib`, async () => {
|
|
370
370
|
ibs.forEach(ib => {
|
|
371
371
|
const ibGib = srcIbGibs[ib];
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
iReckon(sir, ibGib).isGonnaBeTruthy();
|
|
373
|
+
iReckon(sir, ibGib).isGonnaBeTruthy();
|
|
374
|
+
iReckon(sir, ibGib.ib).isGonnaBe(ib);
|
|
375
375
|
})
|
|
376
376
|
});
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
await ifWe(sir, `should have src ib^gib (address) in ancestor rel8n`, async () => {
|
|
379
379
|
const getPrevIbGib: (ib: Ib) => IbGib_V1 | null = (ib) => {
|
|
380
380
|
switch (ib) {
|
|
381
381
|
case "a": return null;
|
|
@@ -388,24 +388,24 @@ describe(`when forking with YES LINKED 'ancestor' rel8n...`, () => {
|
|
|
388
388
|
// the first one forks from the root, so the rel8ns should be undefined which is tested elsewhere
|
|
389
389
|
ibs.filter(ib => ib === "a").forEach(ib => {
|
|
390
390
|
const newIbGib = srcIbGibs[ib]!;
|
|
391
|
-
|
|
392
|
-
// expect(newIbGib?.rel8ns!.ancestor).
|
|
393
|
-
// expect(newIbGib?.rel8ns!.ancestor).
|
|
394
|
-
// expect(newIbGib?.rel8ns!.ancestor!.length).
|
|
391
|
+
iReckon(sir, newIbGib?.rel8ns).toBeUndefined();
|
|
392
|
+
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
393
|
+
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
394
|
+
// expect(newIbGib?.rel8ns!.ancestor!.length).isGonnaBe(1);
|
|
395
395
|
// const prevIbGibAddr = getIbGibAddr({ibGib: prevIbGib});
|
|
396
|
-
// expect(newIbGib?.rel8ns!.ancestor![0]).
|
|
396
|
+
// expect(newIbGib?.rel8ns!.ancestor![0]).isGonnaBe(prevIbGibAddr);
|
|
397
397
|
});
|
|
398
398
|
ibs.filter(ib => ib !== "a").forEach(ib => {
|
|
399
399
|
const newIbGib = srcIbGibs[ib]!;
|
|
400
400
|
const prevIbGib = getPrevIbGib(ib)!;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
402
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
403
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
404
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
405
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor!.length).isGonnaBe(1);
|
|
406
406
|
const prevIbGibAddr = getIbGibAddr({ ibGib: prevIbGib });
|
|
407
|
-
|
|
407
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor![0]).isGonnaBe(prevIbGibAddr);
|
|
408
408
|
});
|
|
409
409
|
});
|
|
410
410
|
|
|
411
|
-
});
|
|
411
|
+
});
|