Skip to content

Commit d6cf82b

Browse files
committed
add tests
1 parent 571f7d5 commit d6cf82b

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/test/localstack-instance.test.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as assert from "node:assert";
22
import { setImmediate } from "node:timers/promises";
33

44
import { window } from "vscode";
5-
import type { LogOutputChannel } from "vscode";
65

76
import { createValueEmitter } from "../utils/emitter.ts";
87
import type {
@@ -58,7 +57,7 @@ function createFixtures() {
5857
}
5958

6059
suite("LocalStack Instance Test Suite", () => {
61-
test("Derives LocalStack instance status correctly", async () => {
60+
test("Derives instance status correctly", async () => {
6261
const { containerStatus, healthStatus, tracker } = createFixtures();
6362

6463
///////////////////////////////////////////////////////////////////////////
@@ -79,4 +78,33 @@ suite("LocalStack Instance Test Suite", () => {
7978
await setImmediate();
8079
assert.strictEqual(tracker.status(), "running");
8180
});
81+
82+
test("Forcing container status derives instance status correctly", async () => {
83+
const { containerStatus, healthStatus, tracker } = createFixtures();
84+
85+
///////////////////////////////////////////////////////////////////////////
86+
tracker.forceContainerStatus("running");
87+
await setImmediate();
88+
assert.strictEqual(tracker.status(), "starting");
89+
90+
///////////////////////////////////////////////////////////////////////////
91+
containerStatus.setValue("running");
92+
await setImmediate();
93+
assert.strictEqual(tracker.status(), "starting");
94+
95+
///////////////////////////////////////////////////////////////////////////
96+
healthStatus.setValue("healthy");
97+
await setImmediate();
98+
assert.strictEqual(tracker.status(), "running");
99+
100+
///////////////////////////////////////////////////////////////////////////
101+
tracker.forceContainerStatus("stopping");
102+
await setImmediate();
103+
assert.strictEqual(tracker.status(), "stopping");
104+
105+
///////////////////////////////////////////////////////////////////////////
106+
containerStatus.setValue("stopped");
107+
await setImmediate();
108+
assert.strictEqual(tracker.status(), "stopped");
109+
});
82110
});

0 commit comments

Comments
 (0)