Skip to content

Commit ee9aecc

Browse files
committed
Fix tests
1 parent 5735792 commit ee9aecc

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

__tests__/astra.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("Astra", () => {
1414
namespace: "test",
1515
});
1616

17-
const results = await astra.createCollection({ collectionName: "blah" });
17+
const results = await astra.createCollection({ name: "blah" });
1818
expect(results.status.ok).to.equal(1);
1919
});
2020

@@ -27,7 +27,7 @@ describe("Astra", () => {
2727
});
2828

2929
const results = await astra.createCollection({
30-
collectionName: "blah",
30+
name: "blahs",
3131
options: {
3232
vector: {
3333
size: 2,
@@ -58,7 +58,7 @@ describe("Astra", () => {
5858
namespace: "test",
5959
});
6060

61-
const collection = await astra.deleteCollection("bah");
61+
const collection = await astra.deleteCollection({name: "bah"});
6262
expect(collection.status.ok).to.equal(1);
6363
});
6464
});

__tests__/collection.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { expect } from "chai";
44

55
const { ASTRA_DB_TOKEN, ASTRA_DB_ID } = process.env;
66

7-
describe.only("Collections", () => {
7+
describe("Collections", () => {
88
describe("Namespaces", () => {
99
test("should create collection", async () => {
1010
const astra = new Astra({
@@ -14,10 +14,10 @@ describe.only("Collections", () => {
1414
namespace: "test",
1515
});
1616

17-
const results = await astra.createCollection({ collectionName: "test" });
17+
const results = await astra.createCollection({ name: "test" });
1818
const countResults = await astra
1919
.collection("test")
20-
.countDocuments("test");
20+
.countDocuments();
2121
expect(countResults.status.count).to.be.greaterThan(0);
2222
});
2323
});

src/collection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ export class Collection {
3636
this.apiConfig = args.apiConfig;
3737
}
3838

39-
public countDocuments = async (opts: CountDocumentsCommands) => {
39+
public countDocuments = async (opts?: CountDocumentsCommands) => {
4040
const response = await axios.post(
4141
`${this.apiConfig.base}/${this.namespace}/${this.collectionName}`,
4242
{
4343
countDocuments: {
44-
filter: opts.filter,
45-
options: opts.options,
44+
filter: opts?.filter,
45+
options: opts?.options,
4646
},
4747
},
4848
this.apiConfig.requestOptions,

0 commit comments

Comments
 (0)