Skip to content

Commit

Permalink
fixup: tests are now building.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoEight committed Feb 7, 2025
1 parent d8f04db commit 4c2fb7f
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ describe("appendToStream - batch append - flood", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ describe("appendToStream - batch append", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
batchSpy = spyOn.call(client, "GRPCStreamCreator");
executeSpy = spyOn.call(client, "execute");
});
Expand Down
6 changes: 1 addition & 5 deletions packages/test/src/streams/appendToStream-errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ describe("appendToStream - errors", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri, throwOnAppendFailure: true },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand Down
12 changes: 4 additions & 8 deletions packages/test/src/streams/deleteStream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ describe("deleteStream", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand All @@ -37,7 +33,7 @@ describe("deleteStream", () => {
expect(result).toBeDefined();

await expect(
collect(client.readStream(ANY_REVISION_STREAM, { maxCount: 10 }))
collect(await client.readStream(ANY_REVISION_STREAM, { maxCount: 10 }))
).rejects.toThrowError(StreamNotFoundError);
});
});
Expand Down Expand Up @@ -68,7 +64,7 @@ describe("deleteStream", () => {

it("succeeds", async () => {
const events = await collect(
client.readStream(STREAM, {
await client.readStream(STREAM, {
maxCount: 1,
direction: BACKWARDS,
fromRevision: "end",
Expand All @@ -84,7 +80,7 @@ describe("deleteStream", () => {
expect(result).toBeDefined();

await expect(
collect(client.readStream(STREAM, { maxCount: 1 }))
collect(await client.readStream(STREAM, { maxCount: 1 }))
).rejects.toThrowError(StreamNotFoundError);
});
});
Expand Down
6 changes: 1 addition & 5 deletions packages/test/src/streams/getStreamMetadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ describe("getStreamMetadata", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand Down
8 changes: 2 additions & 6 deletions packages/test/src/streams/setStreamMetadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ describe("setStreamMetadata", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand Down Expand Up @@ -131,7 +127,7 @@ describe("setStreamMetadata", () => {
await client.appendToStream(STREAM_NAME, jsonTestEvents(20));

let count = 0;
for await (const _ of client.readStream(STREAM_NAME, {
for await (const _ of await client.readStream(STREAM_NAME, {
fromRevision: START,
maxCount: 200,
})) {
Expand Down
8 changes: 1 addition & 7 deletions packages/test/src/streams/subscribeToAll-filters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ describe("subscribeToAll", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{
rootCertificate: node.certs.root,
},
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());

await client.appendToStream(STREAM_NAME_A, jsonTestEvents(4));
await client.appendToStream(STREAM_NAME_B, jsonTestEvents(4));
Expand Down
8 changes: 1 addition & 7 deletions packages/test/src/streams/subscribeToAll.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ describe("subscribeToAll", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{
rootCertificate: node.certs.root,
},
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());

await client.appendToStream(STREAM_NAME_A, jsonTestEvents(4));
await client.appendToStream(STREAM_NAME_B, jsonTestEvents(4));
Expand Down
6 changes: 1 addition & 5 deletions packages/test/src/streams/subscribeToStream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ describe("subscribeToStream", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
await client.appendToStream("out_of_stream_name", jsonTestEvents(4));
});

Expand Down
16 changes: 6 additions & 10 deletions packages/test/src/streams/tombstoneStream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ describe("tombstoneStream", () => {

beforeAll(async () => {
await node.up();
client = new EventStoreDBClient(
{ endpoint: node.uri },
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);
client = EventStoreDBClient.connectionString(node.connectionString());
});

afterAll(async () => {
Expand All @@ -39,7 +35,7 @@ describe("tombstoneStream", () => {
expect(result).toBeDefined();

try {
for await (const event of client.readStream(ANY_REVISION_STREAM, {
for await (const event of await client.readStream(ANY_REVISION_STREAM, {
maxCount: 10,
})) {
expect(event).toBe("Unreachable");
Expand Down Expand Up @@ -81,7 +77,7 @@ describe("tombstoneStream", () => {
it("succeeds", async () => {
let revision!: bigint;

for await (const { event } of client.readStream(STREAM, {
for await (const { event } of await client.readStream(STREAM, {
maxCount: 1,
direction: BACKWARDS,
fromRevision: END,
Expand All @@ -96,7 +92,7 @@ describe("tombstoneStream", () => {
expect(result).toBeDefined();

try {
for await (const event of client.readStream(STREAM, {
for await (const event of await client.readStream(STREAM, {
maxCount: 10,
})) {
expect(event).toBeDefined();
Expand Down Expand Up @@ -143,8 +139,8 @@ describe("tombstoneStream", () => {

expect(result).toBeDefined();

await expect(() =>
collect(client.readStream(NOT_A_STREAM, { maxCount: 10 }))
await expect(async () =>
collect(await client.readStream(NOT_A_STREAM, { maxCount: 10 }))
).rejects.toThrowError(StreamDeletedError);
});
});
Expand Down
9 changes: 1 addition & 8 deletions packages/test/src/utils/enableVersionCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ const checkCapabilities = async () => {
const node = new Cluster(1);
await node.up();

const client = new EventStoreDBClient(
{
endpoint: node.uri,
},
{ rootCertificate: node.certs.root },
{ username: "admin", password: "changeit" }
);

const client = EventStoreDBClient.connectionString(node.connectionString());
const capabilities = await extractVersion.call(client);

await node.down();
Expand Down

0 comments on commit 4c2fb7f

Please sign in to comment.