@fireproof/core 0.20.0-dev-preview-40 → 0.20.0-dev-preview-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/README.md +6 -4
- package/deno/index.js +2 -2
- package/deno/index.js.map +1 -1
- package/deno.json +3 -2
- package/index.cjs +955 -599
- package/index.cjs.map +1 -1
- package/index.d.cts +334 -127
- package/index.d.ts +334 -127
- package/index.js +939 -582
- package/index.js.map +1 -1
- package/indexeddb/index.cjs.map +1 -1
- package/indexeddb/index.js.map +1 -1
- package/indexeddb/metafile-cjs.json +1 -1
- package/indexeddb/metafile-esm.json +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +7 -5
- package/react/index.cjs +17 -9
- package/react/index.cjs.map +1 -1
- package/react/index.d.cts +5 -4
- package/react/index.d.ts +5 -4
- package/react/index.js +17 -9
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/interceptor-gateway.test.ts +15 -1
- package/tests/blockstore/keyed-crypto-indexeddb-file.test.ts +8 -18
- package/tests/blockstore/keyed-crypto.test.ts +31 -53
- package/tests/blockstore/loader.test.ts +21 -19
- package/tests/blockstore/store.test.ts +52 -56
- package/tests/blockstore/transaction.test.ts +13 -11
- package/tests/fireproof/all-gateway.test.ts +53 -50
- package/tests/fireproof/attachable.test.ts +356 -0
- package/tests/fireproof/crdt.test.ts +100 -60
- package/tests/fireproof/database.test.ts +95 -54
- package/tests/fireproof/fireproof.test.ts +58 -55
- package/tests/fireproof/hello.test.ts +4 -4
- package/tests/fireproof/indexer.test.ts +44 -44
- package/tests/fireproof/stable-cid.test.ts +69 -0
- package/tests/fireproof/utils.test.ts +21 -10
- package/tests/gateway/file/loader-config.test.ts +25 -25
- package/tests/gateway/fp-envelope-serialize.test.ts +8 -8
- package/tests/gateway/indexeddb/loader-config.test.ts +6 -6
- package/tests/helpers.ts +81 -2
- package/tests/react/useFireproof.test.tsx +59 -17
@@ -54,12 +54,12 @@ describe("basic Loader simple", function () {
|
|
54
54
|
let t: CarTransaction;
|
55
55
|
const sthis = ensureSuperThis();
|
56
56
|
|
57
|
-
afterEach(async
|
57
|
+
afterEach(async () => {
|
58
58
|
await loader.close();
|
59
59
|
await loader.destroy();
|
60
60
|
});
|
61
61
|
|
62
|
-
beforeEach(async
|
62
|
+
beforeEach(async () => {
|
63
63
|
const testDbName = "test-loader-commit";
|
64
64
|
await sthis.start();
|
65
65
|
const mockM = new MyMemoryBlockStore(sthis);
|
@@ -80,10 +80,10 @@ describe("basic Loader simple", function () {
|
|
80
80
|
it("should have an empty car log", function () {
|
81
81
|
expect(loader.carLog.length).toBe(0);
|
82
82
|
});
|
83
|
-
it("should commit", async
|
83
|
+
it("should commit", async () => {
|
84
84
|
const carGroup = await loader.commit(t, { head: [block.cid] });
|
85
85
|
expect(loader.carLog.length).toBe(1);
|
86
|
-
const reader = await loader.loadCar(carGroup[0]);
|
86
|
+
const reader = await loader.loadCar(carGroup[0], loader.attachedStores.local());
|
87
87
|
expect(reader).toBeTruthy();
|
88
88
|
const parsed = await bs.parseCarFile<CRDTMeta>(reader, loader.logger);
|
89
89
|
expect(parsed.cars).toBeTruthy();
|
@@ -105,7 +105,7 @@ describe("basic Loader with two commits", function () {
|
|
105
105
|
|
106
106
|
const sthis = ensureSuperThis();
|
107
107
|
|
108
|
-
afterEach(async
|
108
|
+
afterEach(async () => {
|
109
109
|
await loader.close();
|
110
110
|
await loader.destroy();
|
111
111
|
});
|
@@ -118,6 +118,7 @@ describe("basic Loader with two commits", function () {
|
|
118
118
|
...simpleBlockOpts(sthis, "test-loader-two-commit"),
|
119
119
|
public: true,
|
120
120
|
});
|
121
|
+
await loader.ready();
|
121
122
|
|
122
123
|
block = await rt.mf.block.encode({
|
123
124
|
value: { hello: "world" },
|
@@ -153,12 +154,12 @@ describe("basic Loader with two commits", function () {
|
|
153
154
|
|
154
155
|
it("should have a car log", function () {
|
155
156
|
expect(loader.carLog.length).toBe(2);
|
156
|
-
expect(loader.carLog[0].toString()).toBe(carCid.toString());
|
157
|
-
expect(loader.carLog[1].toString()).toBe(carCid0.toString());
|
157
|
+
expect(loader.carLog.asArray()[0].toString()).toBe(carCid.toString());
|
158
|
+
expect(loader.carLog.asArray()[1].toString()).toBe(carCid0.toString());
|
158
159
|
});
|
159
160
|
|
160
|
-
it("should commit", async
|
161
|
-
const reader = await loader.loadCar(carCid[0]);
|
161
|
+
it("should commit", async () => {
|
162
|
+
const reader = await loader.loadCar(carCid[0], loader.attachedStores.local());
|
162
163
|
expect(reader).toBeTruthy();
|
163
164
|
const parsed = await bs.parseCarFile<CRDTMeta>(reader, loader.logger);
|
164
165
|
expect(parsed.cars).toBeTruthy();
|
@@ -168,11 +169,11 @@ describe("basic Loader with two commits", function () {
|
|
168
169
|
expect(parsed.meta.head).toBeTruthy();
|
169
170
|
});
|
170
171
|
|
171
|
-
it("should compact", async
|
172
|
+
it("should compact", async () => {
|
172
173
|
const compactCid = await loader.commit(t, { head: [block2.cid] }, { compact: true });
|
173
174
|
expect(loader.carLog.length).toBe(1);
|
174
175
|
|
175
|
-
const reader = await loader.loadCar(compactCid[0]);
|
176
|
+
const reader = await loader.loadCar(compactCid[0], loader.attachedStores.local());
|
176
177
|
expect(reader).toBeTruthy();
|
177
178
|
const parsed = await bs.parseCarFile<CRDTMeta>(reader, loader.logger);
|
178
179
|
expect(parsed.cars).toBeTruthy();
|
@@ -182,8 +183,8 @@ describe("basic Loader with two commits", function () {
|
|
182
183
|
expect(parsed.meta.head).toBeTruthy();
|
183
184
|
});
|
184
185
|
|
185
|
-
it("compact should erase old files", async
|
186
|
-
const cs = await loader.
|
186
|
+
it("compact should erase old files", async () => {
|
187
|
+
const cs = await loader.attachedStores.local().active.car;
|
187
188
|
await loader.commit(t, { head: [block2.cid] }, { compact: true });
|
188
189
|
expect(loader.carLog.length).toBe(1);
|
189
190
|
await loader.commit(t, { head: [block3.cid] }, { compact: false });
|
@@ -196,10 +197,10 @@ describe("basic Loader with two commits", function () {
|
|
196
197
|
await loader.commit(t, { head: [block4.cid] }, { compact: false });
|
197
198
|
expect(loader.carLog.length).toBe(2);
|
198
199
|
|
199
|
-
const e = await loader.loadCar(carCid[0]).catch((e) => e);
|
200
|
+
const e = await loader.loadCar(carCid[0], loader.attachedStores.local()).catch((e) => e);
|
200
201
|
expect(e).toBeTruthy();
|
201
202
|
expect(e instanceof Error).toBeTruthy();
|
202
|
-
expect(e.message).toMatch(
|
203
|
+
expect(e.message).toMatch(/(missing car file)|(not found)/);
|
203
204
|
}, 10000);
|
204
205
|
});
|
205
206
|
|
@@ -211,16 +212,17 @@ describe("basic Loader with index commits", function () {
|
|
211
212
|
// let indexMap: Map<string, CID>;
|
212
213
|
const sthis = ensureSuperThis();
|
213
214
|
|
214
|
-
afterEach(async
|
215
|
+
afterEach(async () => {
|
215
216
|
await ib.close();
|
216
217
|
await ib.destroy();
|
217
218
|
});
|
218
219
|
|
219
|
-
beforeEach(async
|
220
|
+
beforeEach(async () => {
|
220
221
|
const name = "test-loader-index" + Math.random();
|
221
222
|
await sthis.start();
|
222
223
|
// t = new CarTransaction()
|
223
224
|
ib = new bs.EncryptedBlockstore(sthis, simpleBlockOpts(sthis, name));
|
225
|
+
await ib.ready();
|
224
226
|
block = await rt.mf.block.encode({
|
225
227
|
value: { hello: "world" },
|
226
228
|
hasher,
|
@@ -248,7 +250,7 @@ describe("basic Loader with index commits", function () {
|
|
248
250
|
expect(ib.loader.carLog.length).toBe(0);
|
249
251
|
});
|
250
252
|
|
251
|
-
it("should commit the index metadata", async
|
253
|
+
it("should commit the index metadata", async () => {
|
252
254
|
const { cars: carCid } = await ib.transaction<IndexTransactionMeta>(
|
253
255
|
async (t) => {
|
254
256
|
await t.put(block.cid, block.bytes);
|
@@ -262,7 +264,7 @@ describe("basic Loader with index commits", function () {
|
|
262
264
|
|
263
265
|
expect(carLog.length).toBe(1);
|
264
266
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
265
|
-
const reader = await ib.loader.loadCar(carCid![0]);
|
267
|
+
const reader = await ib.loader.loadCar(carCid![0], ib.loader.attachedStores.local());
|
266
268
|
expect(reader).toBeTruthy();
|
267
269
|
const parsed = await bs.parseCarFile<IndexTransactionMeta>(reader, sthis.logger);
|
268
270
|
expect(parsed.cars).toBeTruthy();
|
@@ -1,30 +1,25 @@
|
|
1
1
|
import { CID } from "multiformats";
|
2
|
-
import { rt, bs, NotFoundError,
|
3
|
-
import { noopUrl } from "../helpers.js";
|
2
|
+
import { rt, bs, NotFoundError, PARAM, ensureSuperThis } from "@fireproof/core";
|
4
3
|
import { Result } from "@adviser/cement";
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
describe("DataStore", function () {
|
25
|
-
let store: bs.DataStore;
|
4
|
+
import { mockLoader, noopUrl } from "../helpers.js";
|
5
|
+
|
6
|
+
// function runtime(sthis: SuperThis) {
|
7
|
+
// return bs.toStoreRuntime(sthis);
|
8
|
+
// }
|
9
|
+
|
10
|
+
// async function mockLoader(sthis: SuperThis, name?: string): Promise<bs.StoreFactoryItem> {
|
11
|
+
// const url = noopUrl(name);
|
12
|
+
// return {
|
13
|
+
// // sthis,
|
14
|
+
// url: url,
|
15
|
+
// loader:
|
16
|
+
// };
|
17
|
+
// }
|
18
|
+
|
19
|
+
describe("CarStore", function () {
|
20
|
+
let store: bs.CarStore;
|
26
21
|
const sthis = ensureSuperThis();
|
27
|
-
|
22
|
+
const loader = mockLoader(sthis);
|
28
23
|
|
29
24
|
afterEach(async () => {
|
30
25
|
await store.close();
|
@@ -33,43 +28,44 @@ describe("DataStore", function () {
|
|
33
28
|
|
34
29
|
beforeEach(async () => {
|
35
30
|
await sthis.start();
|
36
|
-
|
37
|
-
store =
|
38
|
-
await store.start();
|
31
|
+
const at = await bs.createAttachedStores(noopUrl("test"), loader);
|
32
|
+
store = at.stores.car;
|
33
|
+
await store.start(at.stores);
|
39
34
|
});
|
40
35
|
|
41
36
|
it("should have a name", function () {
|
42
37
|
expect(store.url().getParam(PARAM.NAME)).toEqual("test");
|
43
38
|
});
|
44
39
|
|
45
|
-
it("should save a car", async
|
40
|
+
it("should save a car", async () => {
|
46
41
|
const car: bs.AnyBlock = {
|
47
42
|
cid: "cidKey" as unknown as CID,
|
48
43
|
bytes: new Uint8Array([55, 56, 57]),
|
49
44
|
};
|
50
45
|
await store.save(car);
|
51
|
-
const data = (await store.realGateway.getPlain(loader, store.url(), car.cid.toString())).Ok();
|
46
|
+
const data = (await store.realGateway.getPlain({ loader }, store.url(), car.cid.toString())).Ok();
|
52
47
|
expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
|
53
48
|
});
|
54
49
|
});
|
55
50
|
|
56
|
-
describe("
|
57
|
-
let store: bs.
|
51
|
+
describe("CarStore with a saved car", function () {
|
52
|
+
let store: bs.CarStore;
|
58
53
|
let car: bs.AnyBlock;
|
59
|
-
let loader: bs.StoreFactoryItem;
|
60
54
|
|
61
55
|
const sthis = ensureSuperThis();
|
56
|
+
const loader = mockLoader(sthis);
|
62
57
|
|
63
58
|
afterEach(async () => {
|
64
59
|
await store.close();
|
65
60
|
await store.destroy();
|
66
61
|
});
|
67
62
|
|
68
|
-
beforeEach(async
|
63
|
+
beforeEach(async () => {
|
69
64
|
await sthis.start();
|
70
|
-
|
71
|
-
|
72
|
-
|
65
|
+
|
66
|
+
const at = await bs.createAttachedStores(noopUrl("test2"), loader);
|
67
|
+
store = at.stores.car;
|
68
|
+
await store.start(at.stores);
|
73
69
|
car = {
|
74
70
|
cid: "cid" as unknown as CID,
|
75
71
|
bytes: new Uint8Array([55, 56, 57, 80]),
|
@@ -77,19 +73,19 @@ describe("DataStore with a saved car", function () {
|
|
77
73
|
await store.save(car);
|
78
74
|
});
|
79
75
|
|
80
|
-
it("should have a car", async
|
81
|
-
const data = (await store.realGateway.getPlain(loader, store.url(), car.cid.toString())).Ok();
|
76
|
+
it("should have a car", async () => {
|
77
|
+
const data = (await store.realGateway.getPlain({ loader }, store.url(), car.cid.toString())).Ok();
|
82
78
|
expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
|
83
79
|
});
|
84
80
|
|
85
|
-
it("should load a car", async
|
81
|
+
it("should load a car", async () => {
|
86
82
|
const loaded = await store.load(car.cid);
|
87
83
|
expect(loaded.cid).toEqual(car.cid);
|
88
84
|
expect(loaded.bytes.constructor.name).toEqual("Uint8Array");
|
89
85
|
expect(loaded.bytes.toString()).toEqual(car.bytes.toString());
|
90
86
|
});
|
91
87
|
|
92
|
-
it("should remove a car", async
|
88
|
+
it("should remove a car", async () => {
|
93
89
|
await store.remove(car.cid);
|
94
90
|
const { e: error } = (await store.load(car.cid).catch((e: Error) => ({ e }))) as { e: NotFoundError };
|
95
91
|
expect(error).toBeTruthy();
|
@@ -99,32 +95,32 @@ describe("DataStore with a saved car", function () {
|
|
99
95
|
describe("MetaStore", function () {
|
100
96
|
let store: bs.MetaStore;
|
101
97
|
const sthis = ensureSuperThis();
|
102
|
-
|
98
|
+
const loader = mockLoader(sthis);
|
103
99
|
|
104
100
|
afterEach(async () => {
|
105
101
|
await store.close();
|
106
102
|
await store.destroy();
|
107
103
|
});
|
108
104
|
|
109
|
-
beforeEach(async
|
105
|
+
beforeEach(async () => {
|
110
106
|
await sthis.start();
|
111
|
-
|
112
|
-
store =
|
113
|
-
await store.start();
|
107
|
+
const at = await bs.createAttachedStores(noopUrl("test"), loader);
|
108
|
+
store = at.stores.meta;
|
109
|
+
await store.start(at.stores);
|
114
110
|
});
|
115
111
|
|
116
112
|
it("should have a name", function () {
|
117
113
|
expect(store.url().getParam(PARAM.NAME)).toEqual("test");
|
118
114
|
});
|
119
115
|
|
120
|
-
it("should save a header", async
|
116
|
+
it("should save a header", async () => {
|
121
117
|
const cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
122
118
|
const h: bs.DbMeta = {
|
123
119
|
cars: [cid],
|
124
120
|
// key: undefined,
|
125
121
|
};
|
126
122
|
await store.save(h);
|
127
|
-
const file = await store.realGateway.getPlain(loader, store.url(), "main");
|
123
|
+
const file = await store.realGateway.getPlain({ loader }, store.url(), "main");
|
128
124
|
const blockMeta = (await rt.gw.fpDeserialize(sthis, store.url(), file)) as Result<bs.FPEnvelopeMeta>;
|
129
125
|
expect(blockMeta.Ok()).toBeTruthy();
|
130
126
|
expect(blockMeta.Ok().payload.length).toEqual(1);
|
@@ -139,30 +135,30 @@ describe("MetaStore with a saved header", function () {
|
|
139
135
|
let store: bs.MetaStore;
|
140
136
|
let cid: CID;
|
141
137
|
const sthis = ensureSuperThis();
|
142
|
-
|
138
|
+
const loader = mockLoader(sthis);
|
143
139
|
|
144
140
|
afterEach(async () => {
|
145
141
|
await store.close();
|
146
142
|
await store.destroy();
|
147
143
|
});
|
148
144
|
|
149
|
-
beforeEach(async
|
145
|
+
beforeEach(async () => {
|
150
146
|
await sthis.start();
|
151
|
-
|
152
|
-
store =
|
153
|
-
await store.start();
|
147
|
+
const at = await bs.createAttachedStores(noopUrl("test3-meta"), loader);
|
148
|
+
store = at.stores.meta;
|
149
|
+
await store.start(at.stores);
|
154
150
|
cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
155
151
|
await store.save({ cars: [cid] /*, key: undefined */ });
|
156
152
|
});
|
157
153
|
|
158
|
-
// it("should load", async
|
154
|
+
// it("should load", async () =>{
|
159
155
|
// expect(onload).toBeTruthy();
|
160
156
|
// expect(onload?.length).toEqual(1);
|
161
157
|
// expect(onload?.[0].cars.toString()).toEqual(cid.toString());
|
162
158
|
// });
|
163
159
|
|
164
|
-
it("should have a header", async
|
165
|
-
const bytes = await store.realGateway.getPlain(loader, store.url(), "main");
|
160
|
+
it("should have a header", async () => {
|
161
|
+
const bytes = await store.realGateway.getPlain({ loader }, store.url(), "main");
|
166
162
|
const data = sthis.txt.decode(bytes.Ok());
|
167
163
|
expect(data).toMatch(/parents/);
|
168
164
|
const header = JSON.parse(data)[0];
|
@@ -179,7 +175,7 @@ describe("MetaStore with a saved header", function () {
|
|
179
175
|
expect(decodedHeader.cars[0].toString()).toEqual(cid.toString());
|
180
176
|
});
|
181
177
|
|
182
|
-
it("should load a header", async
|
178
|
+
it("should load a header", async () => {
|
183
179
|
const loadeds = (await store.load()) as bs.DbMeta[];
|
184
180
|
const loaded = loadeds[0];
|
185
181
|
expect(loaded).toBeTruthy();
|
@@ -5,8 +5,9 @@ import { simpleBlockOpts } from "../helpers.js";
|
|
5
5
|
describe("Fresh TransactionBlockstore", function () {
|
6
6
|
let blocks: BaseBlockstore;
|
7
7
|
const sthis = ensureSuperThis();
|
8
|
-
beforeEach(
|
8
|
+
beforeEach(async () => {
|
9
9
|
blocks = new bs.BaseBlockstoreImpl(simpleBlockOpts(sthis));
|
10
|
+
await blocks.ready();
|
10
11
|
});
|
11
12
|
// it("should not have a name", function () {
|
12
13
|
// expect(blocks.name).toBeFalsy();
|
@@ -14,12 +15,12 @@ describe("Fresh TransactionBlockstore", function () {
|
|
14
15
|
// it("should not have a loader", function () {
|
15
16
|
// expect(blocks.loader).toBeFalsy();
|
16
17
|
// });
|
17
|
-
it("should not put", async
|
18
|
+
it("should not put", async () => {
|
18
19
|
const value = sthis.txt.encode("value");
|
19
20
|
const e = await blocks.put("key" as unknown as bs.AnyLink, value).catch((e) => e);
|
20
21
|
expect(e.message).toMatch(/transaction/g);
|
21
22
|
});
|
22
|
-
it("should yield a transaction", async
|
23
|
+
it("should yield a transaction", async () => {
|
23
24
|
const txR = await blocks.transaction(async (tblocks) => {
|
24
25
|
expect(tblocks).toBeTruthy();
|
25
26
|
expect(tblocks instanceof bs.CarTransactionImpl).toBeTruthy();
|
@@ -34,8 +35,9 @@ describe("Fresh TransactionBlockstore", function () {
|
|
34
35
|
describe("TransactionBlockstore with name", function () {
|
35
36
|
let blocks: bs.EncryptedBlockstore;
|
36
37
|
const sthis = ensureSuperThis();
|
37
|
-
beforeEach(
|
38
|
+
beforeEach(async () => {
|
38
39
|
blocks = new bs.EncryptedBlockstore(sthis, simpleBlockOpts(sthis));
|
40
|
+
await blocks.ready();
|
39
41
|
});
|
40
42
|
// it("should have a name", function () {
|
41
43
|
// expect(blocks.name).toEqual("test");
|
@@ -43,7 +45,7 @@ describe("TransactionBlockstore with name", function () {
|
|
43
45
|
it("should have a loader", function () {
|
44
46
|
expect(blocks.loader).toBeTruthy();
|
45
47
|
});
|
46
|
-
it("should get from loader", async
|
48
|
+
it("should get from loader", async () => {
|
47
49
|
const bytes = sthis.txt.encode("bytes");
|
48
50
|
expect(blocks.loader).toBeTruthy();
|
49
51
|
blocks.loader.getBlock = async (cid) => {
|
@@ -58,12 +60,12 @@ describe("A transaction", function () {
|
|
58
60
|
let tblocks: CarTransaction;
|
59
61
|
let blocks: bs.EncryptedBlockstore;
|
60
62
|
const sthis = ensureSuperThis();
|
61
|
-
beforeEach(async
|
63
|
+
beforeEach(async () => {
|
62
64
|
blocks = new bs.EncryptedBlockstore(sthis, simpleBlockOpts(sthis, "test"));
|
63
65
|
tblocks = new bs.CarTransactionImpl(blocks);
|
64
66
|
blocks.transactions.add(tblocks);
|
65
67
|
});
|
66
|
-
it("should put and get", async
|
68
|
+
it("should put and get", async () => {
|
67
69
|
const cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
68
70
|
const bytes = sthis.txt.encode("bytes");
|
69
71
|
await tblocks.put(cid, bytes);
|
@@ -85,7 +87,7 @@ describe("TransactionBlockstore with a completed transaction", function () {
|
|
85
87
|
let cid2: CID;
|
86
88
|
const sthis = ensureSuperThis();
|
87
89
|
|
88
|
-
beforeEach(async
|
90
|
+
beforeEach(async () => {
|
89
91
|
cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
90
92
|
cid2 = CID.parse("bafybeibgouhn5ktecpjuovt52zamzvm4dlve5ak7x6d5smms3itkhplnhm");
|
91
93
|
|
@@ -101,11 +103,11 @@ describe("TransactionBlockstore with a completed transaction", function () {
|
|
101
103
|
return { head: [] };
|
102
104
|
});
|
103
105
|
});
|
104
|
-
it("should have transactions", async
|
106
|
+
it("should have transactions", async () => {
|
105
107
|
const ts = blocks.transactions;
|
106
108
|
expect(ts.size).toEqual(2);
|
107
109
|
});
|
108
|
-
it("should get", async
|
110
|
+
it("should get", async () => {
|
109
111
|
const value = (await blocks.get(cid)) as bs.AnyBlock;
|
110
112
|
expect(value.cid).toEqual(cid);
|
111
113
|
expect(value.bytes.toString()).toEqual(asUInt8Array("value", sthis).toString());
|
@@ -113,7 +115,7 @@ describe("TransactionBlockstore with a completed transaction", function () {
|
|
113
115
|
const value2 = (await blocks.get(cid2)) as bs.AnyBlock;
|
114
116
|
expect(value2.bytes.toString()).toEqual(asUInt8Array("value2", sthis).toString());
|
115
117
|
});
|
116
|
-
it("should yield entries", async
|
118
|
+
it("should yield entries", async () => {
|
117
119
|
const blz = [];
|
118
120
|
for await (const blk of blocks.entries()) {
|
119
121
|
blz.push(blk);
|