Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonitousconforti committed Jun 11, 2024
1 parent da7e95e commit cfab2b4
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions packages/architect/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,45 @@ describe("Architect tests", () => {
expect(emulatorContainer.Id).toBeDefined();
expect(sharedVolume.Name).toBeDefined();
await architect
.cleanup({ emulatorContainer })
.cleanup({ emulatorContainer, sharedVolume })
.pipe(Effect.provide(NodeContext.layer))
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);
},
ARCHITECT_TEST_TIMEOUT_MS
);

// it(
// "Should be able to create multiple containers at the same time",
// async () => {
// const run1 = architect();
// await new Promise((resolve) => setTimeout(resolve, 3000));
// const run2 = architect();
it(
"Should be able to create multiple containers at the same time",
async () => {
const run1 = architect
.architect()
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);
await new Promise((resolve) => setTimeout(resolve, 3000));
const run2 = architect
.architect()
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);

// const { emulatorContainer: emulatorContainer1 } = await run1;
// expect(emulatorContainer1.id).toBeDefined();
// await emulatorContainer1.stop();
// await emulatorContainer1.remove();
const { emulatorContainer: emulatorContainer1 } = await run1;
expect(emulatorContainer1.Id).toBeDefined();
await architect
.cleanup({ emulatorContainer: emulatorContainer1 })
.pipe(Effect.provide(NodeContext.layer))
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);

// const { emulatorContainer: emulatorContainer2 } = await run2;
// expect(emulatorContainer2.id).toBeDefined();
// await emulatorContainer2.stop();
// await emulatorContainer2.remove();
// },
// ARCHITECT_TEST_TIMEOUT_MS
// );
const { emulatorContainer: emulatorContainer2 } = await run2;
expect(emulatorContainer2.Id).toBeDefined();
await architect
.cleanup({ emulatorContainer: emulatorContainer2 })
.pipe(Effect.provide(NodeContext.layer))
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);
},
ARCHITECT_TEST_TIMEOUT_MS
);

it(
"Should be able to create a single container (one last time just for good measure)",
Expand All @@ -55,7 +67,7 @@ describe("Architect tests", () => {
expect(emulatorContainer.Id).toBeDefined();
expect(sharedVolume.Name).toBeDefined();
await architect
.cleanup({ emulatorContainer })
.cleanup({ emulatorContainer, sharedVolume })
.pipe(Effect.provide(NodeContext.layer))
.pipe(Effect.provide(MobyApi.fromDockerHostEnvironmentVariable))
.pipe(Effect.runPromise);
Expand Down

0 comments on commit cfab2b4

Please sign in to comment.