Skip to content

Commit 3e4ea08

Browse files
committed
Add user agent header
1 parent da8ccf7 commit 3e4ea08

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# @datastax/astra-ts-client
1+
# @datastax/ts-astra-db
22

33
Astra TS is a TypeScript library for interacting with the [Astra](https://astra.datastax.com/) API.
44

55
## Initializing the client
66

77
```typescript
8-
import { Astra } from "@datastax/astra-ts-client";
8+
import { Astra } from "@datastax/ts-astra-db";
99

1010
const astra = new Astra({
1111
token: 'REPLACE_ME',

__tests__/collection.test.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe("Collections", () => {
6060
expect(insertResults.status.insertedIds).length.to.have.length(2);
6161
await astra.deleteCollection({ name: collectionName });
6262
});
63-
test("should update one", async () => {
63+
test.skip("should update one", async () => {
6464
const collectionName = `test${epoch}`;
6565
await astra.createCollection({ name: collectionName });
6666
const insertResults = await astra.collection(collectionName).insertOne({
@@ -80,8 +80,26 @@ describe("Collections", () => {
8080
},
8181
});
8282
console.log(updateResults);
83-
// expect(insertResults.status.insertedIds).length.to.have.length(2);
84-
// await astra.deleteCollection({ name: collectionName });
83+
await astra.deleteCollection({ name: collectionName });
84+
});
85+
test.only('should delete one', async () => {
86+
const collectionName = `test${epoch}`;
87+
await astra.createCollection({ name: collectionName });
88+
const insertResults = await astra.collection(collectionName).insertOne({
89+
document: {
90+
name: "Alex",
91+
age: 1,
92+
},
93+
});
94+
const countResults = await astra.collection(collectionName).countDocuments();
95+
expect(countResults.status.count).to.equal(1);
96+
const deleteResults = await astra.collection(collectionName).deleteOne({
97+
filter: {
98+
age: 1,
99+
}
100+
});
101+
expect(countResults.status.count).to.equal(0);
102+
await astra.deleteCollection({ name: collectionName });
85103
});
86104
});
87105
});

src/astra.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class Astra {
2525
this.requestOptions = {
2626
headers: {
2727
"X-Cassandra-Token": this.config.token,
28+
"user-agent": "astra-ts-client/0.0.1",
2829
},
2930
};
3031
}

src/collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export interface AstraCollectionArgs {
2424
}
2525

2626
export class Collection {
27-
private collectionName: string;
28-
private namespace: string;
27+
private readonly collectionName: string;
28+
private readonly namespace: string;
2929
private apiConfig: {
3030
base: string;
3131
requestOptions: any;

0 commit comments

Comments
 (0)