@fireproof/core 0.20.0-dev-preview-50 → 0.20.0-dev-preview-51

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.
@@ -136,6 +136,19 @@ describe("named Ledger with record", function () {
136
136
  expect(doc._id).toBe("hello");
137
137
  expect(doc.value).toBe("universe");
138
138
  });
139
+ it("should update with Date value", async function () {
140
+ const date = new Date();
141
+ const dateStr = date.toISOString();
142
+ const ok = await db.put({ _id: "hello", value: date });
143
+ expect(ok.id).toBe("hello");
144
+ const doc = await db.get<Doc>("hello");
145
+ expect(doc).toBeTruthy();
146
+ expect(doc._id).toBe("hello");
147
+ expect(doc.value).toBe(dateStr);
148
+ expect(typeof doc.value).toBe("string");
149
+ const parsed = new Date(doc.value);
150
+ expect(parsed).toStrictEqual(date);
151
+ });
139
152
  it("should update with null value", async function () {
140
153
  const ok = await db.put({ _id: "hello", value: null });
141
154
  expect(ok.id).toBe("hello");
@@ -121,23 +121,26 @@ describe("database fullconfig", () => {
121
121
  it("have the right name", async () => {
122
122
  let protocol: string | undefined;
123
123
  const url = sthis.env.get("FP_STORAGE_URL");
124
+ let path = "";
124
125
  if (url) {
125
- protocol = URI.from(url).protocol;
126
+ const uri = URI.from(url);
127
+ protocol = uri.protocol;
128
+ path = uri.pathname;
126
129
  }
127
- const base = bs.getDefaultURI(sthis, protocol);
130
+ const base = bs.getDefaultURI(sthis, protocol).build().appendRelative(path).URI();
128
131
  const db = fireproof("my-funky-name", {
129
132
  storeUrls: {
130
133
  base: base,
131
134
  // meta: `${base}/meta?taste=${taste}`,
132
135
  data: {
133
- meta: base.build().pathname("dist/full/meta"),
134
- car: base.build().pathname("dist/full/data"),
135
- wal: base.build().pathname("dist/full/wal"),
136
+ meta: base.build().appendRelative("funky/meta"),
137
+ car: base.build().appendRelative("funky/data"),
138
+ wal: base.build().appendRelative("funky/wal"),
136
139
  },
137
140
  idx: {
138
- meta: base.build().pathname("dist/full/idx-meta"),
139
- car: base.build().pathname("dist/full/idx-data"),
140
- wal: base.build().pathname("dist/full/idx-wal"),
141
+ meta: base.build().appendRelative("funky/idx-meta"),
142
+ car: base.build().appendRelative("funky/idx-data"),
143
+ wal: base.build().appendRelative("funky/idx-wal"),
141
144
  },
142
145
  // wal: `${base}/wal?taste=${taste}`,
143
146
  },