From b363fd3b11cf50a2437ad3c7a59f102413dbe6bc Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Wed, 23 Apr 2025 12:35:05 +0200 Subject: [PATCH] Update code examples and a few test names due to renamed methods --- src/collections.ts | 2 +- src/cursors.ts | 14 +++++++------- src/databases.ts | 2 +- src/test/06-managing-functions.ts | 6 +++--- src/test/10-manipulating-collections.ts | 2 +- src/test/22-foxx-api.ts | 6 +++--- src/test/24-accessing-views.ts | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/collections.ts b/src/collections.ts index 9c2c60be8..904ff1943 100644 --- a/src/collections.ts +++ b/src/collections.ts @@ -688,7 +688,7 @@ export interface DocumentCollection< * ```js * const db = new Database(); * const collection = db.collection("some-collection"); - * const result = await collection.setProperties({ waitForSync: true }); + * const result = await collection.properties({ waitForSync: true }); * // the collection will now wait for data being written to disk * // whenever a document is changed * ``` diff --git a/src/cursors.ts b/src/cursors.ts index 1e9c1adc7..4ac018dc6 100644 --- a/src/cursors.ts +++ b/src/cursors.ts @@ -342,9 +342,9 @@ export class BatchCursor { * aql`FOR x IN 1..5 RETURN x`, * { batchSize: 1 } * ); - * console.log(cursor.hasMore); // true + * console.log(cursor.batches.hasMore); // true * await cursor.batches.loadAll(); - * console.log(cursor.hasMore); // false + * console.log(cursor.batches.hasMore); // false * console.log(cursor.hasNext); // true * for await (const item of cursor) { * console.log(item); @@ -417,7 +417,7 @@ export class BatchCursor { * Advances the cursor by applying the `callback` function to each item in * the cursor's remaining result list until the cursor is depleted or * `callback` returns the exact value `false`. Returns a promise that - * evalues to `true` unless the function returned `false`. + * evaluates to `true` unless the function returned `false`. * * **Note**: If the result set spans multiple batches, any remaining batches * will only be fetched on demand. Depending on the cursor's TTL and the @@ -732,14 +732,14 @@ export class BatchCursor { * @example * ```js * const cursor1 = await db.query(aql`FOR x IN 1..5 RETURN x`); - * console.log(cursor1.hasMore); // false + * console.log(cursor1.batches.hasMore); // false * await cursor1.kill(); // no effect * * const cursor2 = await db.query( * aql`FOR x IN 1..5 RETURN x`, * { batchSize: 2 } * ); - * console.log(cursor2.hasMore); // true + * console.log(cursor2.batches.hasMore); // true * await cursor2.kill(); // cursor is depleted * ``` */ @@ -1220,14 +1220,14 @@ export class Cursor { * @example * ```js * const cursor1 = await db.query(aql`FOR x IN 1..5 RETURN x`); - * console.log(cursor1.hasMore); // false + * console.log(cursor1.batches.hasMore); // false * await cursor1.kill(); // no effect * * const cursor2 = await db.query( * aql`FOR x IN 1..5 RETURN x`, * { batchSize: 2 } * ); - * console.log(cursor2.hasMore); // true + * console.log(cursor2.batches.hasMore); // true * await cursor2.kill(); // cursor is depleted * ``` */ diff --git a/src/databases.ts b/src/databases.ts index 4ed4e2d9f..f48a3189f 100644 --- a/src/databases.ts +++ b/src/databases.ts @@ -3067,7 +3067,7 @@ export class Database { * ```js * const db = new Database(); * // track up to 5 slow queries exceeding 5 seconds execution time - * await db.setQueryTracking({ + * await db.queryTracking({ * enabled: true, * trackSlowQueries: true, * maxSlowQueries: 5, diff --git a/src/test/06-managing-functions.ts b/src/test/06-managing-functions.ts index 4e8f30dcb..53e097122 100644 --- a/src/test/06-managing-functions.ts +++ b/src/test/06-managing-functions.ts @@ -18,7 +18,7 @@ describe("Managing functions", function () { system.close(); } }); - describe("database.listFunctions", () => { + describe("database.listUserFunctions", () => { it("should be empty per default", async () => { const result = await db.listUserFunctions(); expect(result).to.be.instanceof(Array); @@ -37,7 +37,7 @@ describe("Managing functions", function () { isDeterministic: false, }); }); - describe("database.createFunction", () => { + describe("database.createUserFunction", () => { it("should create a function", async () => { const info = await db.createUserFunction( "myfunctions::temperature::celsiustofahrenheit2", @@ -47,7 +47,7 @@ describe("Managing functions", function () { expect(info).to.have.property("error", false); }); }); - describe("database.dropFunction", () => { + describe("database.dropUserFunction", () => { it("should drop a existing function", async () => { const name = "myfunctions::temperature::celsiustofahrenheit"; await db.createUserFunction( diff --git a/src/test/10-manipulating-collections.ts b/src/test/10-manipulating-collections.ts index f53908c86..2dcdad613 100644 --- a/src/test/10-manipulating-collections.ts +++ b/src/test/10-manipulating-collections.ts @@ -65,7 +65,7 @@ describe("Manipulating collections", function () { expect(info).to.have.property("type", 3); // edge collection }); }); - describe("collection.setProperties", () => { + describe("collection.properties", () => { it("should change properties", async () => { const info = await collection.properties({ waitForSync: true }); expect(info).to.have.property("name", collection.name); diff --git a/src/test/22-foxx-api.ts b/src/test/22-foxx-api.ts index 51e9c0606..b8370ea33 100644 --- a/src/test/22-foxx-api.ts +++ b/src/test/22-foxx-api.ts @@ -855,7 +855,7 @@ describe("Foxx service", () => { "getServiceDependencies", (mount: string) => db.getServiceDependencies(mount), ], - ["listServiceScripts", (mount: string) => db.getServiceScripts(mount)], + ["getServiceScripts", (mount: string) => db.getServiceScripts(mount)], ["upgradeService", (mount: string) => db.upgradeService(mount, {} as any)], [ "updateServiceConfiguration", @@ -882,11 +882,11 @@ describe("Foxx service", () => { ["uninstallService", (mount: string) => db.uninstallService(mount)], ["downloadService", (mount: string) => db.downloadService(mount)], [ - "enableServiceDevelopmentMode", + "setServiceDevelopmentMode_true", (mount: string) => db.setServiceDevelopmentMode(mount, true), ], [ - "disableServiceDevelopmentMode", + "setServiceDevelopmentMode_false", (mount: string) => db.setServiceDevelopmentMode(mount, false), ], [ diff --git a/src/test/24-accessing-views.ts b/src/test/24-accessing-views.ts index 0cdc063bd..663bc6b17 100644 --- a/src/test/24-accessing-views.ts +++ b/src/test/24-accessing-views.ts @@ -21,7 +21,7 @@ describe("Accessing views", function () { system.close(); } }); - describe("database.arangoSearchView", () => { + describe("database.view", () => { it("returns a View instance for the view", () => { const name = "potato"; const view = db.view(name);