@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.
@@ -73,10 +73,10 @@ function buildRel8nsToAddOrRemoveFromPrimitives(rel8nNames: string[]): IbGibRel8
73
73
  return result;
74
74
  }
75
75
 
76
- describe(`can't rel8 primitives to others`, () => {
76
+ await respecfully(sir, `can't rel8 primitives to others`, async () => {
77
77
  for (const src of PRIMITIVE_IBGIBS) {
78
78
 
79
- it(`should fail to add rel8ns`, async () => {
79
+ await ifWe(sir, `should fail to add rel8ns`, async () => {
80
80
  let errored = false;
81
81
  try {
82
82
  const rel8nsToAddByAddr = buildRel8nsToAddOrRemoveFromPrimitives(SIMPLE_REL8N_NAMES);
@@ -84,10 +84,10 @@ describe(`can't rel8 primitives to others`, () => {
84
84
  } catch (error) {
85
85
  errored = true;
86
86
  }
87
- expect(errored).toBeTrue()
87
+ iReckon(sir, errored).toBeTrue()
88
88
  });
89
89
 
90
- it(`should fail to remove rel8ns`, async () => {
90
+ await ifWe(sir, `should fail to remove rel8ns`, async () => {
91
91
  let errored = false;
92
92
  try {
93
93
  const rel8nsToRemoveByAddr = buildRel8nsToAddOrRemoveFromPrimitives(SIMPLE_REL8N_NAMES);
@@ -95,10 +95,10 @@ describe(`can't rel8 primitives to others`, () => {
95
95
  } catch (error) {
96
96
  errored = true;
97
97
  }
98
- expect(errored).toBeTrue()
98
+ iReckon(sir, errored).toBeTrue()
99
99
  });
100
100
 
101
- it(`should fail to add and remove rel8ns`, async () => {
101
+ await ifWe(sir, `should fail to add and remove rel8ns`, async () => {
102
102
  let errored = false;
103
103
  try {
104
104
  const rel8nsToAddByAddr =
@@ -109,18 +109,18 @@ describe(`can't rel8 primitives to others`, () => {
109
109
  } catch (error) {
110
110
  errored = true;
111
111
  }
112
- expect(errored).toBeTrue()
112
+ iReckon(sir, errored).toBeTrue()
113
113
  });
114
114
 
115
115
  }
116
116
  });
117
117
 
118
- describe(`when rel8ing a regular ibgib`, () => {
118
+ await respecfully(sir, `when rel8ing a regular ibgib`, async () => {
119
119
 
120
- describe(`simple rel8ns to 1st gens (from primitives)`, () => {
120
+ await respecfully(sir, `simple rel8ns to 1st gens (from primitives)`, async () => {
121
121
  for (const primitive of PRIMITIVE_IBGIBS) {
122
122
 
123
- it(`should add/remove simple rel8ns`, async () => {
123
+ await ifWe(sir, `should add/remove simple rel8ns`, async () => {
124
124
 
125
125
  let { newIbGib: src } = await fork({ src: primitive, noTimestamp: true });
126
126
 
@@ -133,18 +133,18 @@ describe(`when rel8ing a regular ibgib`, () => {
133
133
 
134
134
  const { newIbGib: rel8nsAddedIbGib } =
135
135
  await rel8({ src, rel8nsToAddByAddr, noTimestamp: true });
136
- expect(rel8nsAddedIbGib).toBeTruthy();
137
- expect(rel8nsAddedIbGib.rel8ns).toBeTruthy();
138
- expect(rel8nsAddedIbGib.rel8ns).toBeTruthy();
136
+ iReckon(sir, rel8nsAddedIbGib).isGonnaBeTruthy();
137
+ iReckon(sir, rel8nsAddedIbGib.rel8ns).isGonnaBeTruthy();
138
+ iReckon(sir, rel8nsAddedIbGib.rel8ns).isGonnaBeTruthy();
139
139
  const rel8nNames_AddedIbGib = Object.keys(rel8nsAddedIbGib.rel8ns!);
140
140
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
141
- expect(rel8nNames_AddedIbGib).toContain(simpleRel8nName);
141
+ iReckon(sir, rel8nNames_AddedIbGib).toContain(simpleRel8nName);
142
142
  const simpleRel8nAddrs = rel8nsAddedIbGib.rel8ns![simpleRel8nName]!;
143
143
  // expect(simpleRel8nAddrs).not.toHaveSize(0);
144
- expect(simpleRel8nAddrs).not.toHaveSize(0);
144
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
145
145
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
146
- expect(expectedRel8nAddrs).not.toHaveSize(0);
147
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
146
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
147
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
148
148
  });
149
149
 
150
150
  // #endregion
@@ -158,9 +158,9 @@ describe(`when rel8ing a regular ibgib`, () => {
158
158
 
159
159
  const { newIbGib: rel8nsRemovedIbGib } =
160
160
  await rel8({ src: rel8nsAddedIbGib, rel8nsToRemoveByAddr, noTimestamp: true });
161
- expect(rel8nsRemovedIbGib).toBeTruthy();
162
- expect(rel8nsRemovedIbGib.rel8ns).toBeTruthy();
163
- expect(rel8nsRemovedIbGib.rel8ns).toBeTruthy();
161
+ iReckon(sir, rel8nsRemovedIbGib).isGonnaBeTruthy();
162
+ iReckon(sir, rel8nsRemovedIbGib.rel8ns).isGonnaBeTruthy();
163
+ iReckon(sir, rel8nsRemovedIbGib.rel8ns).isGonnaBeTruthy();
164
164
 
165
165
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
166
166
  const rel8dAddrs = rel8nsRemovedIbGib.rel8ns![simpleRel8nName]!;
@@ -189,7 +189,7 @@ describe(`when rel8ing a regular ibgib`, () => {
189
189
  * then for src2, we'll make the call from the dna generated from the src1 transforms.
190
190
  * both should make the same transformations with regards to the rel8ns added/removed.
191
191
  */
192
- it(`should create pure, reproducible dna`, async () => {
192
+ await ifWe(sir, `should create pure, reproducible dna`, async () => {
193
193
 
194
194
  const ib1 = 'ib 1 yo';
195
195
  let { newIbGib: src1 } = await fork({ src: primitive, noTimestamp: true, destIb: ib1 });
@@ -206,19 +206,19 @@ describe(`when rel8ing a regular ibgib`, () => {
206
206
 
207
207
  const { newIbGib: rel8nsAddedIbGib, intermediateIbGibs, dnas: dnasRel8Add } =
208
208
  await rel8({ src: src1, rel8nsToAddByAddr, noTimestamp: true, dna: true });
209
- expect(dnasRel8Add).toBeTruthy();
210
- expect(dnasRel8Add).toBeTruthy();
209
+ iReckon(sir, dnasRel8Add).isGonnaBeTruthy();
210
+ iReckon(sir, dnasRel8Add).isGonnaBeTruthy();
211
211
  // ATOW dna only produces 1
212
212
  const rel8DnaAdd = dnasRel8Add![0];
213
213
  const rel8DnaDataAdd: TransformOpts_Rel8<IbGib_V1> = clone(rel8DnaAdd.data!);
214
214
  const rel8nNames_AddedIbGib = Object.keys(rel8nsAddedIbGib.rel8ns!);
215
215
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
216
- expect(rel8nNames_AddedIbGib).toContain(simpleRel8nName);
216
+ iReckon(sir, rel8nNames_AddedIbGib).toContain(simpleRel8nName);
217
217
  const simpleRel8nAddrs = rel8nsAddedIbGib.rel8ns![simpleRel8nName]!;
218
- expect(simpleRel8nAddrs).not.toHaveSize(0);
218
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
219
219
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
220
- expect(expectedRel8nAddrs).not.toHaveSize(0);
221
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
220
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
221
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
222
222
  });
223
223
 
224
224
  // rerun the same rel8 call, but get the args from the dna of the
@@ -230,12 +230,12 @@ describe(`when rel8ing a regular ibgib`, () => {
230
230
  await rel8(rel8DnaDataAdd);
231
231
  const rel8nNames_AddedIbGib2 = Object.keys(rel8nsAddedIbGib2.rel8ns!);
232
232
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
233
- expect(rel8nNames_AddedIbGib2).toContain(simpleRel8nName);
233
+ iReckon(sir, rel8nNames_AddedIbGib2).toContain(simpleRel8nName);
234
234
  const simpleRel8nAddrs = rel8nsAddedIbGib2.rel8ns![simpleRel8nName]!;
235
- expect(simpleRel8nAddrs).not.toHaveSize(0);
235
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
236
236
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
237
- expect(expectedRel8nAddrs).not.toHaveSize(0);
238
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
237
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
238
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
239
239
  });
240
240
 
241
241
  // #endregion
@@ -298,15 +298,15 @@ describe(`when rel8ing a regular ibgib`, () => {
298
298
  //#endregion
299
299
  });
300
300
 
301
- it(`should rel8 linked rel8ns to make only one rel8n`, async () => {
301
+ await ifWe(sir, `should rel8 linked rel8ns to make only one rel8n`, async () => {
302
302
  // linkedRel8ns should produce a rel8n that only has one target
303
303
  let testRel8nName = 'test';
304
304
  let { newIbGib: src1 } =
305
305
  await fork({ src: primitive, linkedRel8ns: ['past', 'ancestor'] });
306
306
  let src1Addr = getIbGibAddr({ ibGib: src1 });
307
- expect((src1?.rel8ns?.past || []).length).withContext('src1.rel8ns.past.length').toEqual(0);
307
+ iReckon(sir, (src1?.rel8ns?.past || []).length).asTo('src1.rel8ns.past.length').isGonnaBe(0);
308
308
  if (primitive.ib !== 'ib') {
309
- expect((src1?.rel8ns?.ancestor || []).length).withContext('src1.rel8ns.ancestor.length').toEqual(1);
309
+ iReckon(sir, (src1?.rel8ns?.ancestor || []).length).asTo('src1.rel8ns.ancestor.length').isGonnaBe(1);
310
310
  }
311
311
 
312
312
  let { newIbGib: src2 } =
@@ -315,12 +315,12 @@ describe(`when rel8ing a regular ibgib`, () => {
315
315
  rel8nsToAddByAddr: { [testRel8nName]: ['a^gib'] },
316
316
  linkedRel8ns: ['past', 'ancestor', testRel8nName],
317
317
  });
318
- expect((src2?.rel8ns?.past || []).length).withContext('src2.rel8ns.past.length').toEqual(1);
318
+ iReckon(sir, (src2?.rel8ns?.past || []).length).asTo('src2.rel8ns.past.length').isGonnaBe(1);
319
319
  if (primitive.ib !== 'ib') {
320
- expect((src2?.rel8ns?.ancestor || []).length).withContext('src2.rel8ns.ancestor.length').toEqual(1);
320
+ iReckon(sir, (src2?.rel8ns?.ancestor || []).length).asTo('src2.rel8ns.ancestor.length').isGonnaBe(1);
321
321
  }
322
- expect((src2?.rel8ns![testRel8nName] || []).length).withContext(`src2.rel8ns.${testRel8nName}.length`).toEqual(1);
323
- expect(src2?.rel8ns![testRel8nName]![0]).withContext(`src2.rel8ns.${testRel8nName}[0]`).toEqual('a^gib');
322
+ iReckon(sir, (src2?.rel8ns![testRel8nName] || []).length).asTo(`src2.rel8ns.${testRel8nName}.length`).isGonnaBe(1);
323
+ iReckon(sir, src2?.rel8ns![testRel8nName]![0]).asTo(`src2.rel8ns.${testRel8nName}[0]`).isGonnaBe('a^gib');
324
324
 
325
325
  let { newIbGib: src3 } =
326
326
  await rel8({
@@ -328,16 +328,16 @@ describe(`when rel8ing a regular ibgib`, () => {
328
328
  rel8nsToAddByAddr: { [testRel8nName]: ['b^gib'] },
329
329
  linkedRel8ns: ['past', 'ancestor', testRel8nName],
330
330
  });
331
- expect((src3?.rel8ns?.past || []).length).withContext('src3.rel8ns.past.length').toEqual(1);
331
+ iReckon(sir, (src3?.rel8ns?.past || []).length).asTo('src3.rel8ns.past.length').isGonnaBe(1);
332
332
  if (primitive.ib !== 'ib') {
333
- expect((src3?.rel8ns?.ancestor || []).length).withContext('src3.rel8ns.ancestor.length').toEqual(1);
333
+ iReckon(sir, (src3?.rel8ns?.ancestor || []).length).asTo('src3.rel8ns.ancestor.length').isGonnaBe(1);
334
334
  }
335
- expect((src3?.rel8ns![testRel8nName] || []).length).withContext(`src3.rel8ns.${testRel8nName}.length`).toEqual(1);
336
- expect(src3?.rel8ns![testRel8nName]![0]).withContext(`src3.rel8ns.${testRel8nName}[0]`).toEqual('b^gib');
335
+ iReckon(sir, (src3?.rel8ns![testRel8nName] || []).length).asTo(`src3.rel8ns.${testRel8nName}.length`).isGonnaBe(1);
336
+ iReckon(sir, src3?.rel8ns![testRel8nName]![0]).asTo(`src3.rel8ns.${testRel8nName}[0]`).isGonnaBe('b^gib');
337
337
 
338
338
  });
339
339
 
340
- it(`should rel8 tjp ASAP, i.e. first rel8 after fork, also shoehorned tjpGib testing`, async () => {
340
+ await ifWe(sir, `should rel8 tjp ASAP, i.e. first rel8 after fork, also shoehorned tjpGib testing`, async () => {
341
341
  // the tjp rel8n should be set ASAP because it's very important.
342
342
  // so if the first transform after fork is a rel8, then do it there.
343
343
  const testRel8ns = { irrelevant: ['ib^gib'] };
@@ -345,30 +345,30 @@ describe(`when rel8ing a regular ibgib`, () => {
345
345
  await fork({ src: primitive, tjp: { uuid: true, timestamp: true } });
346
346
  const tjpAddr = getIbGibAddr({ ibGib: tjpIbGib });
347
347
  const tjpAddrGib = getIbAndGib({ ibGibAddr: tjpAddr }).gib;
348
- expect(tjpIbGib?.data?.isTjp).withContext('src1.data.isTjp').toBeTruthy();
349
- expect(tjpIbGib?.rel8ns?.tjp).withContext('src1.rel8ns.tjp').toBeUndefined();
348
+ iReckon(sir, tjpIbGib?.data?.isTjp).asTo('src1.data.isTjp').isGonnaBeTruthy();
349
+ iReckon(sir, tjpIbGib?.rel8ns?.tjp).asTo('src1.rel8ns.tjp').toBeUndefined();
350
350
  const { newIbGib: hasRel8dTjp } =
351
351
  await rel8({ src: tjpIbGib, rel8nsToAddByAddr: testRel8ns });
352
352
  const hasRel8dTjpAddr = getIbGibAddr({ ibGib: hasRel8dTjp });
353
353
  const hasRel8dTjpAddrGib = getIbAndGib({ ibGibAddr: hasRel8dTjpAddr }).gib;
354
- expect(hasRel8dTjp?.data?.isTjp).withContext('src2.data.isTjp').toBeUndefined();
355
- expect(hasRel8dTjp?.rel8ns?.tjp).withContext('src2.rel8ns.tjp').toBeTruthy();
356
- expect(hasRel8dTjp!.rel8ns!.tjp!.length).withContext('src2.rel8ns.tjp.length').toEqual(1);
357
- expect(hasRel8dTjp!.rel8ns!.tjp!).toContain(tjpAddr);
354
+ iReckon(sir, hasRel8dTjp?.data?.isTjp).asTo('src2.data.isTjp').toBeUndefined();
355
+ iReckon(sir, hasRel8dTjp?.rel8ns?.tjp).asTo('src2.rel8ns.tjp').isGonnaBeTruthy();
356
+ iReckon(sir, hasRel8dTjp!.rel8ns!.tjp!.length).asTo('src2.rel8ns.tjp.length').isGonnaBe(1);
357
+ iReckon(sir, hasRel8dTjp!.rel8ns!.tjp!).toContain(tjpAddr);
358
358
 
359
359
  // the gib should not just be the hash, since it has a tjp timeline
360
- expect(hasRel8dTjpAddrGib).toContain(tjpAddrGib);
360
+ iReckon(sir, hasRel8dTjpAddrGib).toContain(tjpAddrGib);
361
361
 
362
362
  // shoe-horning in here some getGibInfo testing...eesh
363
363
  const hasRel8dTjpGibInfo = getGibInfo({ ibGibAddr: hasRel8dTjpAddr }); // via addr
364
- expect(hasRel8dTjpGibInfo.isPrimitive).toBeUndefined();
365
- expect(hasRel8dTjpGibInfo.piecesCount).toEqual(2, 'pieces count');
364
+ iReckon(sir, hasRel8dTjpGibInfo.isPrimitive).toBeUndefined();
365
+ iReckon(sir, hasRel8dTjpGibInfo.piecesCount).isGonnaBe(2, 'pieces count');
366
366
  const hasRel8dTjpHash = await sha256v1(hasRel8dTjp, '');
367
- expect(hasRel8dTjpGibInfo.punctiliarHash).toEqual(hasRel8dTjpHash, 'punctiliarHash');
368
- expect(hasRel8dTjpGibInfo.tjpGib).toEqual(tjpAddrGib);
367
+ iReckon(sir, hasRel8dTjpGibInfo.punctiliarHash).isGonnaBe(hasRel8dTjpHash, 'punctiliarHash');
368
+ iReckon(sir, hasRel8dTjpGibInfo.tjpGib).isGonnaBe(tjpAddrGib);
369
369
  // the info should be the same if we get it straight from the gib
370
370
  const hasRel8dTjpGibInfo_viaGib = getGibInfo({ gib: hasRel8dTjpAddrGib }); // via gib
371
- expect(hasRel8dTjpGibInfo_viaGib).toEqual(hasRel8dTjpGibInfo, 'infos via addr and gib should be equal');
371
+ iReckon(sir, hasRel8dTjpGibInfo_viaGib).isGonnaBe(hasRel8dTjpGibInfo, 'infos via addr and gib should be equal');
372
372
 
373
373
  // ok, yes my testing is out of control, but I'm going to shoehorn in here
374
374
  // another rel8 and make sure that the punctiliar hash is correct and the gib only has two pieces.
@@ -378,22 +378,22 @@ describe(`when rel8ing a regular ibgib`, () => {
378
378
  const thirdGenAddr = getIbGibAddr({ ibGib: thirdGenIbGib });
379
379
  const thirdGenGibInfo = getGibInfo({ ibGibAddr: thirdGenAddr });
380
380
  const thirdGenHash = await sha256v1(thirdGenIbGib, '');
381
- expect(thirdGenGibInfo.punctiliarHash).toEqual(thirdGenHash);
382
- expect(thirdGenGibInfo.tjpGib).toEqual(tjpAddrGib, 'third gen match tjpAddrGib');
383
- expect(thirdGenGibInfo.piecesCount).toEqual(2, 'third gen pieces');
381
+ iReckon(sir, thirdGenGibInfo.punctiliarHash).isGonnaBe(thirdGenHash);
382
+ iReckon(sir, thirdGenGibInfo.tjpGib).isGonnaBe(tjpAddrGib, 'third gen match tjpAddrGib');
383
+ iReckon(sir, thirdGenGibInfo.piecesCount).isGonnaBe(2, 'third gen pieces');
384
384
  });
385
385
  }
386
386
  });
387
387
 
388
- describe(`nCounter`, () => {
389
- it(`should increment existing n counter`, async () => {
388
+ await respecfully(sir, `nCounter`, async () => {
389
+ await ifWe(sir, `should increment existing n counter`, async () => {
390
390
  for (const primitive of PRIMITIVE_IBGIBS) {
391
391
  let { newIbGib: src_0 } =
392
392
  await fork({ src: primitive, nCounter: true });
393
393
 
394
- expect(src_0.data).toBeTruthy();
395
- expect(src_0.data!.n).toEqual(0);
396
- expect(src_0!.data?.isTjp).withContext("isTjp").toBeUndefined();
394
+ iReckon(sir, src_0.data).isGonnaBeTruthy();
395
+ iReckon(sir, src_0.data!.n).isGonnaBe(0);
396
+ iReckon(sir, src_0!.data?.isTjp).asTo("isTjp").toBeUndefined();
397
397
 
398
398
  const rel8nsToAddByAddr = buildRel8nsToAddOrRemoveFromPrimitives(SIMPLE_REL8N_NAMES);
399
399
 
@@ -407,35 +407,35 @@ describe(`when rel8ing a regular ibgib`, () => {
407
407
  noTimestamp: true,
408
408
  nCounter: true
409
409
  });
410
- expect(src_1).toBeTruthy();
411
- expect(src_1.rel8ns).toBeTruthy();
412
- expect(src_1.rel8ns).toBeTruthy();
410
+ iReckon(sir, src_1).isGonnaBeTruthy();
411
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
412
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
413
413
  const rel8nNames_AddedIbGib = Object.keys(src_1.rel8ns!);
414
414
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
415
- expect(rel8nNames_AddedIbGib).toContain(simpleRel8nName);
415
+ iReckon(sir, rel8nNames_AddedIbGib).toContain(simpleRel8nName);
416
416
  const simpleRel8nAddrs = src_1.rel8ns![simpleRel8nName]!;
417
- expect(simpleRel8nAddrs).not.toHaveSize(0);
417
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
418
418
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
419
- expect(expectedRel8nAddrs).not.toHaveSize(0);
420
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
419
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
420
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
421
421
  });
422
422
 
423
- expect(src_1.data).toBeTruthy();
424
- expect(src_1.data).toBeTruthy();
425
- expect(src_1.data!.n).toBeTruthy();
426
- expect(src_1.data!.n).toBeTruthy();
427
- expect(src_1.data!.n).toEqual(1);
428
- expect(src_1!.data?.isTjp).withContext("isTjp").toBeUndefined();
423
+ iReckon(sir, src_1.data).isGonnaBeTruthy();
424
+ iReckon(sir, src_1.data).isGonnaBeTruthy();
425
+ iReckon(sir, src_1.data!.n).isGonnaBeTruthy();
426
+ iReckon(sir, src_1.data!.n).isGonnaBeTruthy();
427
+ iReckon(sir, src_1.data!.n).isGonnaBe(1);
428
+ iReckon(sir, src_1!.data?.isTjp).asTo("isTjp").toBeUndefined();
429
429
  }
430
430
  });
431
- it(`should start new n counter, implicit nCounter falsy`, async () => {
431
+ await ifWe(sir, `should start new n counter, implicit nCounter falsy`, async () => {
432
432
  for (const primitive of PRIMITIVE_IBGIBS) {
433
433
  let { newIbGib: src_0 } =
434
434
  await fork({ src: primitive });
435
435
 
436
- expect(src_0.data).toBeTruthy();
437
- expect(src_0.data).toBeTruthy();
438
- expect(src_0.data!.n).toBeUndefined();
436
+ iReckon(sir, src_0.data).isGonnaBeTruthy();
437
+ iReckon(sir, src_0.data).isGonnaBeTruthy();
438
+ iReckon(sir, src_0.data!.n).toBeUndefined();
439
439
 
440
440
  const rel8nsToAddByAddr = buildRel8nsToAddOrRemoveFromPrimitives(SIMPLE_REL8N_NAMES);
441
441
 
@@ -449,32 +449,32 @@ describe(`when rel8ing a regular ibgib`, () => {
449
449
  noTimestamp: true,
450
450
  nCounter: true
451
451
  });
452
- expect(src_1).toBeTruthy();
453
- expect(src_1.rel8ns).toBeTruthy();
454
- expect(src_1.rel8ns).toBeTruthy();
452
+ iReckon(sir, src_1).isGonnaBeTruthy();
453
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
454
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
455
455
  const rel8nNames_AddedIbGib = Object.keys(src_1.rel8ns!);
456
456
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
457
- expect(rel8nNames_AddedIbGib).toContain(simpleRel8nName);
457
+ iReckon(sir, rel8nNames_AddedIbGib).toContain(simpleRel8nName);
458
458
  const simpleRel8nAddrs = src_1.rel8ns![simpleRel8nName]!;
459
- expect(simpleRel8nAddrs).not.toHaveSize(0);
459
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
460
460
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
461
- expect(expectedRel8nAddrs).not.toHaveSize(0);
462
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
461
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
462
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
463
463
  });
464
464
 
465
- expect(src_1.data).toBeTruthy();
466
- expect(src_1.data!.n).toEqual(0);
465
+ iReckon(sir, src_1.data).isGonnaBeTruthy();
466
+ iReckon(sir, src_1.data!.n).isGonnaBe(0);
467
467
  }
468
468
  });
469
- it(`should start new n counter, explicit nCounter falsy`, async () => {
469
+ await ifWe(sir, `should start new n counter, explicit nCounter falsy`, async () => {
470
470
  for (const primitive of PRIMITIVE_IBGIBS) {
471
471
  let { newIbGib: src_0 } =
472
472
  await fork({ src: primitive, nCounter: false });
473
473
 
474
- expect(src_0.data).toBeTruthy();
475
- expect(src_0.data).toBeTruthy();
476
- expect(src_0.data!.n).toBeUndefined();
477
- expect(src_0!.data!.isTjp).withContext("isTjp").toBeUndefined();
474
+ iReckon(sir, src_0.data).isGonnaBeTruthy();
475
+ iReckon(sir, src_0.data).isGonnaBeTruthy();
476
+ iReckon(sir, src_0.data!.n).toBeUndefined();
477
+ iReckon(sir, src_0!.data!.isTjp).asTo("isTjp").toBeUndefined();
478
478
 
479
479
  const rel8nsToAddByAddr = buildRel8nsToAddOrRemoveFromPrimitives(SIMPLE_REL8N_NAMES);
480
480
 
@@ -488,22 +488,22 @@ describe(`when rel8ing a regular ibgib`, () => {
488
488
  noTimestamp: true,
489
489
  nCounter: true
490
490
  });
491
- expect(src_1).toBeTruthy();
492
- expect(src_1.rel8ns).toBeTruthy();
493
- expect(src_1.rel8ns).toBeTruthy();
491
+ iReckon(sir, src_1).isGonnaBeTruthy();
492
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
493
+ iReckon(sir, src_1.rel8ns).isGonnaBeTruthy();
494
494
  const rel8nNames_AddedIbGib = Object.keys(src_1.rel8ns!);
495
495
  SIMPLE_REL8N_NAMES.forEach(simpleRel8nName => {
496
- expect(rel8nNames_AddedIbGib).toContain(simpleRel8nName);
496
+ iReckon(sir, rel8nNames_AddedIbGib).toContain(simpleRel8nName);
497
497
  const simpleRel8nAddrs = src_1.rel8ns![simpleRel8nName]!;
498
- expect(simpleRel8nAddrs).not.toHaveSize(0);
498
+ iReckon(sir, simpleRel8nAddrs).not.toHaveSize(0);
499
499
  const expectedRel8nAddrs = rel8nsToAddByAddr[simpleRel8nName];
500
- expect(expectedRel8nAddrs).not.toHaveSize(0);
501
- expect(simpleRel8nAddrs).toEqual(expectedRel8nAddrs!);
500
+ iReckon(sir, expectedRel8nAddrs).not.toHaveSize(0);
501
+ iReckon(sir, simpleRel8nAddrs).isGonnaBe(expectedRel8nAddrs!);
502
502
  });
503
503
 
504
- expect(src_1.data).toBeTruthy();
505
- expect(src_1.data!.n).toEqual(0);
506
- expect(src_1!.data!.isTjp).withContext("isTjp").toBeUndefined();
504
+ iReckon(sir, src_1.data).isGonnaBeTruthy();
505
+ iReckon(sir, src_1.data!.n).isGonnaBe(0);
506
+ iReckon(sir, src_1!.data!.isTjp).asTo("isTjp").toBeUndefined();
507
507
  }
508
508
  });
509
509
  // for (const primitive of PRIMITIVE_IBGIBS) {
@@ -518,15 +518,15 @@ describe(`when rel8ing a regular ibgib`, () => {
518
518
  // dataToAddOrPatch: DATA_SIMPLE_XY,
519
519
  // nCounter: true
520
520
  // });
521
- // expect(src_1.data).toBeTruthy();
522
- // expect(src_1.data!.n).toEqual(0);
521
+ // expect(src_1.data).isGonnaBeTruthy();
522
+ // expect(src_1.data!.n).isGonnaBe(0);
523
523
  // }
524
524
  // });
525
525
 
526
526
  });
527
527
 
528
- describe(`when rel8 with dna`, () => {
529
- it(`should have gibs that is corroborated with getGib`, async () => {
528
+ await respecfully(sir, `when rel8 with dna`, async () => {
529
+ await ifWe(sir, `should have gibs that is corroborated with getGib`, async () => {
530
530
  for (const primitive of PRIMITIVE_IBGIBS) {
531
531
  let { newIbGib: src_0 } =
532
532
  await fork({ src: primitive, nCounter: false, dna: true });
@@ -549,7 +549,7 @@ describe(`when rel8ing a regular ibgib`, () => {
549
549
  for (let i = 0; i < ibGibs.length; i++) {
550
550
  const ibGib = ibGibs[i];
551
551
  const gottenGib = await getGib({ ibGib });
552
- expect(ibGib.gib).toEqual(gottenGib);
552
+ iReckon(sir, ibGib.gib).isGonnaBe(gottenGib);
553
553
  }
554
554
  }
555
555
  });
@@ -25,21 +25,21 @@ const PRIMITIVE_IBGIBS = [
25
25
  }),
26
26
  ];
27
27
 
28
- describe(`isDna`, () => {
28
+ await respecfully(sir, `isDna`, async () => {
29
29
  for (const src of PRIMITIVE_IBGIBS) {
30
30
 
31
- it(`should return true for dna ibgibs`, async () => {
31
+ await ifWe(sir, `should return true for dna ibgibs`, async () => {
32
32
  const resFork = await fork({ src, dna: true });
33
33
  resFork.dnas?.every(x => {
34
34
  const resIsDna = isDna({ ibGib: x });
35
- expect(resIsDna).toBeTrue()
35
+ iReckon(sir, resIsDna).toBeTrue()
36
36
  });
37
37
  });
38
38
 
39
- it(`should return false for non-dna ibgibs`, async () => {
39
+ await ifWe(sir, `should return false for non-dna ibgibs`, async () => {
40
40
  const resFork = await fork({ src, dna: true });
41
41
  const resIsDna = isDna({ ibGib: resFork.newIbGib });
42
- expect(resIsDna).toBeFalse();
42
+ iReckon(sir, resIsDna).toBeFalse();
43
43
  });
44
44
 
45
45
  }
@@ -0,0 +1,62 @@
1
+ import { ifWe, ifWeMight, iReckon, respecfully } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
2
+ const maam = `[${import.meta.url}]`, sir = maam;
3
+
4
+ import { getIbAndGib, getIbGibAddr } from './helper.mjs';
5
+ import { Ib, IbGib } from './types.mjs';
6
+ import { ROOT, ROOT_ADDR } from './V1/constants.mjs';
7
+
8
+
9
+ await respecfully(sir, `getIbGibAddr`, async () => {
10
+ // unsure if these would change when not in V1...(these tests are outside V1 atow)
11
+
12
+ await ifWe(sir, `should get the right addr for ROOT`, async () => {
13
+ let ibGib = ROOT;
14
+ let gotten = getIbGibAddr({ ibGib });
15
+ iReckon(sir, gotten).isGonnaBeTruthy();
16
+ iReckon(sir, gotten).isGonnaBe(ROOT_ADDR);
17
+ });
18
+
19
+ await ifWe(sir, `should get the right addr for primitives`, async () => {
20
+ let ibs: Ib[] = ['7', 'foo', 'ibgib', 'wakka doodle'];
21
+ for (let i = 0; i < ibs.length; i++) {
22
+ const ib = ibs[i];
23
+ let ibGib: IbGib = { ib, gib: 'gib' };
24
+ let gotten = getIbGibAddr({ ibGib });
25
+ iReckon(sir, gotten).isGonnaBeTruthy();
26
+ iReckon(sir, gotten).isGonnaBe(`${ib}^gib`);
27
+ }
28
+ });
29
+
30
+ });
31
+
32
+ await respecfully(sir, `getIbAndGib`, async () => {
33
+ // unsure if these would change when not in V1...(these tests are outside V1 atow)
34
+
35
+ await ifWe(sir, `should get the right ib & gib for ROOT, with ibGib param`, async () => {
36
+ let ibGib = ROOT;
37
+ let gotten = getIbAndGib({ ibGib });
38
+ iReckon(sir, gotten).isGonnaBeTruthy();
39
+ iReckon(sir, gotten.ib).isGonnaBe('ib');
40
+ iReckon(sir, gotten.gib).isGonnaBe('gib');
41
+ });
42
+
43
+ await ifWe(sir, `should get the right ib & gib for ROOT_ADDR, with ibGibAddr param`, async () => {
44
+ let gotten = getIbAndGib({ ibGibAddr: ROOT_ADDR });
45
+ iReckon(sir, gotten).isGonnaBeTruthy();
46
+ iReckon(sir, gotten.ib).isGonnaBe('ib');
47
+ iReckon(sir, gotten.gib).isGonnaBe('gib');
48
+ });
49
+
50
+ await ifWe(sir, `should get the right ib & gib for primitives`, async () => {
51
+ let ibs: Ib[] = ['7', 'foo', 'ibgib', 'wakka doodle'];
52
+ for (let i = 0; i < ibs.length; i++) {
53
+ const ib = ibs[i];
54
+ let ibGib: IbGib = { ib, gib: 'gib' };
55
+ let gotten = getIbAndGib({ ibGib });
56
+ iReckon(sir, gotten).isGonnaBeTruthy();
57
+ iReckon(sir, gotten.ib).isGonnaBe(ib);
58
+ iReckon(sir, gotten.gib).isGonnaBe('gib');
59
+ }
60
+ });
61
+
62
+ });