@roc-db/test-utils 0.2.0-pre.23 → 0.2.0-pre.25

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -306,7 +306,7 @@ var readEntity = readOperation("readEntity", z17.string(), z17.union([PostSchema
306
306
  import { Query as Query11, readOperation as readOperation2 } from "roc-db";
307
307
  var readPost = readOperation2("readPost", PostRefSchema, PostSchema, (txn) => {
308
308
  const ref = txn.payload;
309
- return Query11(() => txn.readEntity(ref));
309
+ return Query11(() => txn.readEntity(ref, true));
310
310
  });
311
311
 
312
312
  // src/operations/updateBlockParagraph.ts
@@ -435,6 +435,9 @@ var testAdapterImplementation = (adapterConstructor, engineArgsAdapter1 = {}, en
435
435
  expect(readPostRes.data.tags).toStrictEqual(["Foo", "Bar"]);
436
436
  expect(readPostRes).toMatchZodSchema(PostSchema);
437
437
  });
438
+ test("read not found (readEntity function)", async () => {
439
+ expect(() => adapter1.readPost("Post/999")).toThrow(NotFoundError2);
440
+ });
438
441
  test("update (updateEntity function)", async () => {
439
442
  const [post2] = await adapter1.updatePost({
440
443
  ref: postRef,
@@ -446,18 +449,20 @@ var testAdapterImplementation = (adapterConstructor, engineArgsAdapter1 = {}, en
446
449
  expect(post2).toMatchZodSchema(PostSchema);
447
450
  });
448
451
  test("updateTitle (patchEntity function + debounce)", async () => {
449
- const updatePostTitleRes1 = await adapter1.updatePostTitle({
452
+ const [update1, mutation1] = await adapter1.updatePostTitle({
450
453
  ref: postRef,
451
454
  title: "Title 3"
452
455
  });
453
- expect(updatePostTitleRes1[0]).toMatchZodSchema(PostSchema);
454
- const updatePostTitleRes2 = await adapter1.updatePostTitle({
456
+ expect(update1).toMatchZodSchema(PostSchema);
457
+ expect(mutation1).toMatchZodSchema(UpdatePostTitleMutationSchema);
458
+ const [update2, mutation2] = await adapter1.updatePostTitle({
455
459
  ref: postRef,
456
460
  title: "Title 4"
457
461
  });
458
- expect(updatePostTitleRes2[0]).toMatchZodSchema(PostSchema);
459
- expect(updatePostTitleRes2[1].ref).toBe(updatePostTitleRes1[1].ref);
460
- expect(updatePostTitleRes2[1].timestamp >= updatePostTitleRes1[1].timestamp).toBeTrue();
462
+ expect(update2).toMatchZodSchema(PostSchema);
463
+ expect(mutation2).toMatchZodSchema(UpdatePostTitleMutationSchema);
464
+ expect(mutation1.ref).toBe(mutation2.ref);
465
+ expect(mutation2.timestamp >= mutation1.timestamp).toBeTrue();
461
466
  });
462
467
  test("delete (deleteEntity function)", async () => {
463
468
  const [count, mutation] = await adapter1.deletePost(postRef);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/test-utils",
3
- "version": "0.2.0-pre.23",
3
+ "version": "0.2.0-pre.25",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "sideEffects": false,
19
19
  "peerDependencies": {
20
- "roc-db": "0.2.0-pre.23",
20
+ "roc-db": "0.2.0-pre.25",
21
21
  "zod": "3.24.2"
22
22
  },
23
23
  "keywords": [],