@rljson/io 0.0.47 → 0.0.50
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/dist/conformance-tests/goldens/dump/empty.json +49 -21
- package/dist/conformance-tests/goldens/dump/two-tables.json +113 -73
- package/dist/conformance-tests/goldens/dumpTable/table1.json +2 -2
- package/dist/conformance-tests/goldens/rawTableCfgs.json +120 -74
- package/dist/conformance-tests/goldens/tableCfgs-1.json +57 -21
- package/dist/conformance-tests/goldens/tableCfgs.json +46 -18
- package/dist/conformance-tests/io-conformance.spec.ts +202 -38
- package/dist/io.js +85 -15
- package/package.json +2 -2
|
@@ -16,16 +16,33 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
import { hip, hsh, rmhsh } from '@rljson/hash';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
import {
|
|
20
|
+
addColumnsToTableCfg,
|
|
21
|
+
exampleTableCfg,
|
|
22
|
+
Rljson,
|
|
23
|
+
TableCfg,
|
|
24
|
+
TableType,
|
|
25
|
+
} from '@rljson/rljson';
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
afterAll,
|
|
29
|
+
afterEach,
|
|
30
|
+
beforeAll,
|
|
31
|
+
beforeEach,
|
|
32
|
+
describe,
|
|
33
|
+
expect,
|
|
34
|
+
it,
|
|
35
|
+
} from 'vitest';
|
|
22
36
|
|
|
23
37
|
import { Io, IoTestSetup, IoTools } from '@rljson/io';
|
|
24
38
|
|
|
25
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
testMemSetup,
|
|
41
|
+
testPeerServerSetup,
|
|
42
|
+
testPeerSetup,
|
|
43
|
+
} from './io-conformance.setup.ts';
|
|
26
44
|
import { expectGolden, ExpectGoldenOptions } from './setup/goldens.ts';
|
|
27
45
|
|
|
28
|
-
|
|
29
46
|
const ego: ExpectGoldenOptions = {
|
|
30
47
|
npmUpdateGoldensEnabled: false,
|
|
31
48
|
};
|
|
@@ -109,17 +126,37 @@ export const runIoConformanceTests = (
|
|
|
109
126
|
isRoot: false,
|
|
110
127
|
isShared: true,
|
|
111
128
|
columns: [
|
|
112
|
-
{
|
|
113
|
-
|
|
129
|
+
{
|
|
130
|
+
key: '_hash',
|
|
131
|
+
type: 'string',
|
|
132
|
+
titleShort: 'Hash',
|
|
133
|
+
titleLong: 'Hash',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
key: 'col0',
|
|
137
|
+
type: 'string',
|
|
138
|
+
titleShort: 'Col 0',
|
|
139
|
+
titleLong: 'Column 0',
|
|
140
|
+
},
|
|
114
141
|
],
|
|
115
142
|
};
|
|
116
143
|
|
|
117
144
|
const tableV1 = addColumnsToTableCfg(tableV0, [
|
|
118
|
-
{
|
|
145
|
+
{
|
|
146
|
+
key: 'col1',
|
|
147
|
+
type: 'string',
|
|
148
|
+
titleShort: 'Col 1',
|
|
149
|
+
titleLong: 'Column 1',
|
|
150
|
+
},
|
|
119
151
|
]);
|
|
120
152
|
|
|
121
153
|
const tableV2 = addColumnsToTableCfg(tableV1, [
|
|
122
|
-
{
|
|
154
|
+
{
|
|
155
|
+
key: 'col2',
|
|
156
|
+
type: 'string',
|
|
157
|
+
titleShort: 'Col 2',
|
|
158
|
+
titleLong: 'Column 2',
|
|
159
|
+
},
|
|
123
160
|
]);
|
|
124
161
|
|
|
125
162
|
await io.createOrExtendTable({ tableCfg: tableV0 });
|
|
@@ -145,17 +182,37 @@ export const runIoConformanceTests = (
|
|
|
145
182
|
isRoot: false,
|
|
146
183
|
isShared: true,
|
|
147
184
|
columns: [
|
|
148
|
-
{
|
|
149
|
-
|
|
185
|
+
{
|
|
186
|
+
key: '_hash',
|
|
187
|
+
type: 'string',
|
|
188
|
+
titleShort: 'Hash',
|
|
189
|
+
titleLong: 'Hash',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
key: 'col0',
|
|
193
|
+
type: 'string',
|
|
194
|
+
titleShort: 'Col 0',
|
|
195
|
+
titleLong: 'Column 0',
|
|
196
|
+
},
|
|
150
197
|
],
|
|
151
198
|
};
|
|
152
199
|
|
|
153
200
|
const tableV1 = addColumnsToTableCfg(tableV0, [
|
|
154
|
-
{
|
|
201
|
+
{
|
|
202
|
+
key: 'col1',
|
|
203
|
+
type: 'string',
|
|
204
|
+
titleShort: 'Col 1',
|
|
205
|
+
titleLong: 'Column 1',
|
|
206
|
+
},
|
|
155
207
|
]);
|
|
156
208
|
|
|
157
209
|
const tableV2 = addColumnsToTableCfg(tableV1, [
|
|
158
|
-
{
|
|
210
|
+
{
|
|
211
|
+
key: 'col2',
|
|
212
|
+
type: 'string',
|
|
213
|
+
titleShort: 'Col 2',
|
|
214
|
+
titleLong: 'Column 2',
|
|
215
|
+
},
|
|
159
216
|
]);
|
|
160
217
|
|
|
161
218
|
await io.createOrExtendTable({ tableCfg: tableV0 });
|
|
@@ -179,7 +236,7 @@ export const runIoConformanceTests = (
|
|
|
179
236
|
await expect(
|
|
180
237
|
io.createOrExtendTable({ tableCfg: tableCfg }),
|
|
181
238
|
).rejects.toThrow(
|
|
182
|
-
'Hash "wrongHash" does not match the newly calculated one "
|
|
239
|
+
'Hash "wrongHash" does not match the newly calculated one "9jZWK-5WPpnlQHCWSPg80D". ' +
|
|
183
240
|
'Please make sure that all systems are producing the same hashes.',
|
|
184
241
|
);
|
|
185
242
|
|
|
@@ -190,7 +247,7 @@ export const runIoConformanceTests = (
|
|
|
190
247
|
}
|
|
191
248
|
|
|
192
249
|
expect(message).toBe(
|
|
193
|
-
'Hash "wrongHash" does not match the newly calculated one "
|
|
250
|
+
'Hash "wrongHash" does not match the newly calculated one "9jZWK-5WPpnlQHCWSPg80D". ' +
|
|
194
251
|
'Please make sure that all systems are producing the same hashes.',
|
|
195
252
|
);
|
|
196
253
|
});
|
|
@@ -242,6 +299,8 @@ export const runIoConformanceTests = (
|
|
|
242
299
|
{
|
|
243
300
|
key: 'x',
|
|
244
301
|
type: 'unknown' as any,
|
|
302
|
+
titleShort: 'X',
|
|
303
|
+
titleLong: 'Column X',
|
|
245
304
|
},
|
|
246
305
|
],
|
|
247
306
|
});
|
|
@@ -404,7 +463,7 @@ export const runIoConformanceTests = (
|
|
|
404
463
|
b: 5,
|
|
405
464
|
},
|
|
406
465
|
],
|
|
407
|
-
_tableCfg: '
|
|
466
|
+
_tableCfg: 'GUGis7DIUDWCLFUJQZwJQ1',
|
|
408
467
|
_type: 'components',
|
|
409
468
|
},
|
|
410
469
|
};
|
|
@@ -412,9 +471,24 @@ export const runIoConformanceTests = (
|
|
|
412
471
|
|
|
413
472
|
// Update the table by adding a new column
|
|
414
473
|
const tableCfg2 = addColumnsToTableCfg(tableCfg, [
|
|
415
|
-
{
|
|
416
|
-
|
|
417
|
-
|
|
474
|
+
{
|
|
475
|
+
key: 'keyA1',
|
|
476
|
+
type: 'string',
|
|
477
|
+
titleShort: 'Key A1',
|
|
478
|
+
titleLong: 'Key A1',
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
key: 'keyA2',
|
|
482
|
+
type: 'string',
|
|
483
|
+
titleShort: 'Key A2',
|
|
484
|
+
titleLong: 'Key A2',
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
key: 'keyB2',
|
|
488
|
+
type: 'string',
|
|
489
|
+
titleShort: 'Key B2',
|
|
490
|
+
titleLong: 'Key B2',
|
|
491
|
+
},
|
|
418
492
|
]);
|
|
419
493
|
|
|
420
494
|
await io.createOrExtendTable({ tableCfg: tableCfg2 });
|
|
@@ -460,7 +534,7 @@ export const runIoConformanceTests = (
|
|
|
460
534
|
keyB2: 'b2',
|
|
461
535
|
},
|
|
462
536
|
],
|
|
463
|
-
_tableCfg: '
|
|
537
|
+
_tableCfg: '73RBnYL3eR5SRPx7rMFiWN',
|
|
464
538
|
_type: 'components',
|
|
465
539
|
},
|
|
466
540
|
});
|
|
@@ -473,10 +547,30 @@ export const runIoConformanceTests = (
|
|
|
473
547
|
const tableCfg: TableCfg = {
|
|
474
548
|
...exampleCfg,
|
|
475
549
|
columns: [
|
|
476
|
-
{
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
550
|
+
{
|
|
551
|
+
key: '_hash',
|
|
552
|
+
type: 'string',
|
|
553
|
+
titleShort: 'Hash',
|
|
554
|
+
titleLong: 'Hash',
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
key: 'keyA1',
|
|
558
|
+
type: 'string',
|
|
559
|
+
titleShort: 'Key A1',
|
|
560
|
+
titleLong: 'Key A1',
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
key: 'keyA2',
|
|
564
|
+
type: 'string',
|
|
565
|
+
titleShort: 'Key A2',
|
|
566
|
+
titleLong: 'Key A2',
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
key: 'keyB2',
|
|
570
|
+
type: 'string',
|
|
571
|
+
titleShort: 'Key B2',
|
|
572
|
+
titleLong: 'Key B2',
|
|
573
|
+
},
|
|
480
574
|
],
|
|
481
575
|
};
|
|
482
576
|
|
|
@@ -537,13 +631,48 @@ export const runIoConformanceTests = (
|
|
|
537
631
|
const tableCfg: TableCfg = {
|
|
538
632
|
...exampleCfg,
|
|
539
633
|
columns: [
|
|
540
|
-
{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
{
|
|
634
|
+
{
|
|
635
|
+
key: '_hash',
|
|
636
|
+
type: 'string',
|
|
637
|
+
titleShort: 'Hash',
|
|
638
|
+
titleLong: 'Hash',
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
key: 'string',
|
|
642
|
+
type: 'string',
|
|
643
|
+
titleShort: 'String',
|
|
644
|
+
titleLong: 'String',
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: 'number',
|
|
648
|
+
type: 'number',
|
|
649
|
+
titleShort: 'Number',
|
|
650
|
+
titleLong: 'Number',
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
key: 'null',
|
|
654
|
+
type: 'string',
|
|
655
|
+
titleShort: 'Null',
|
|
656
|
+
titleLong: 'Null',
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
key: 'boolean',
|
|
660
|
+
type: 'boolean',
|
|
661
|
+
titleShort: 'Boolean',
|
|
662
|
+
titleLong: 'Boolean',
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
key: 'array',
|
|
666
|
+
type: 'jsonArray',
|
|
667
|
+
titleShort: 'Array',
|
|
668
|
+
titleLong: 'Array',
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
key: 'object',
|
|
672
|
+
type: 'json',
|
|
673
|
+
titleShort: 'Object',
|
|
674
|
+
titleLong: 'Object',
|
|
675
|
+
},
|
|
547
676
|
],
|
|
548
677
|
};
|
|
549
678
|
|
|
@@ -627,13 +756,48 @@ export const runIoConformanceTests = (
|
|
|
627
756
|
const tableCfg: TableCfg = {
|
|
628
757
|
...exampleCfg,
|
|
629
758
|
columns: [
|
|
630
|
-
{
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
{
|
|
759
|
+
{
|
|
760
|
+
key: '_hash',
|
|
761
|
+
type: 'string',
|
|
762
|
+
titleShort: 'Hash',
|
|
763
|
+
titleLong: 'Hash',
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
key: 'string',
|
|
767
|
+
type: 'string',
|
|
768
|
+
titleShort: 'String',
|
|
769
|
+
titleLong: 'String',
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
key: 'number',
|
|
773
|
+
type: 'number',
|
|
774
|
+
titleShort: 'Number',
|
|
775
|
+
titleLong: 'Number',
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
key: 'null',
|
|
779
|
+
type: 'string',
|
|
780
|
+
titleShort: 'Null',
|
|
781
|
+
titleLong: 'Null',
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
key: 'boolean',
|
|
785
|
+
type: 'boolean',
|
|
786
|
+
titleShort: 'Boolean',
|
|
787
|
+
titleLong: 'Boolean',
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
key: 'array',
|
|
791
|
+
type: 'jsonArray',
|
|
792
|
+
titleShort: 'Array',
|
|
793
|
+
titleLong: 'Array',
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
key: 'object',
|
|
797
|
+
type: 'json',
|
|
798
|
+
titleShort: 'Object',
|
|
799
|
+
titleLong: 'Object',
|
|
800
|
+
},
|
|
637
801
|
],
|
|
638
802
|
};
|
|
639
803
|
|