Use schema guard for SSH bridge error tests
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
34ca6507db
commit
30199ae5e5
1 file changed
+5
-2
@@ -5,6 +5,7 @@ import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
||||
|
||||
import {
|
||||
@@ -33,6 +34,8 @@ function makeHttpClientLayer(
|
||||
);
|
||||
}
|
||||
|
||||
const isSshHttpBridgeError = Schema.is(SshHttpBridgeError);
|
||||
|
||||
describe("SSH environment IPC", () => {
|
||||
it.effect("fetches and decodes the remote environment descriptor", () => {
|
||||
const requestUrls: string[] = [];
|
||||
@@ -83,7 +86,7 @@ describe("SSH environment IPC", () => {
|
||||
|
||||
assert.instanceOf(error, DesktopSshEnvironmentRequestError);
|
||||
assert.equal(error.operation, "fetch-environment-descriptor");
|
||||
assert.equal(error.cause instanceof SshHttpBridgeError, false);
|
||||
assert.isFalse(isSshHttpBridgeError(error.cause));
|
||||
}).pipe(Effect.provide(layer));
|
||||
});
|
||||
|
||||
@@ -108,7 +111,7 @@ describe("SSH environment IPC", () => {
|
||||
const error = failure.value;
|
||||
|
||||
assert.instanceOf(error, DesktopSshEnvironmentRequestError);
|
||||
assert.instanceOf(error.cause, SshHttpBridgeError);
|
||||
assert.isTrue(isSshHttpBridgeError(error.cause));
|
||||
assert.equal(requestCount, 0);
|
||||
}).pipe(Effect.provide(layer));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user