@remit/drizzle-service 0.0.60 → 0.0.61
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/package.json
CHANGED
|
@@ -135,6 +135,14 @@ describe("MailboxRepo", () => {
|
|
|
135
135
|
);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
test("findByPathPrefix finds nothing in a flat namespace", async () => {
|
|
139
|
+
const accountId = randomId();
|
|
140
|
+
await repo.create(makeMailboxInput(accountId, "Work"));
|
|
141
|
+
await repo.create(makeMailboxInput(accountId, "Workshop"));
|
|
142
|
+
|
|
143
|
+
assert.deepEqual(await repo.findByPathPrefix(accountId, "Work", ""), []);
|
|
144
|
+
});
|
|
145
|
+
|
|
138
146
|
test("renameChildPaths updates all children", async () => {
|
|
139
147
|
const accountId = randomId();
|
|
140
148
|
await repo.create(makeMailboxInput(accountId, "OldName/Sub1"));
|
package/src/repos/i4-mailbox.ts
CHANGED
|
@@ -306,6 +306,9 @@ export class MailboxRepo implements IMailboxRepository {
|
|
|
306
306
|
pathPrefix: string,
|
|
307
307
|
delimiter = "/",
|
|
308
308
|
): Promise<MailboxItem[]> {
|
|
309
|
+
// A flat namespace nests nothing: with no delimiter the prefix is the
|
|
310
|
+
// folder’s own path, which would match every sibling starting with it.
|
|
311
|
+
if (delimiter.length === 0) return [];
|
|
309
312
|
const rows = await this.db
|
|
310
313
|
.select()
|
|
311
314
|
.from(mailboxTable)
|