From b18744d197323e18e6410686695df27e559fafcf Mon Sep 17 00:00:00 2001 From: BluJ Date: Thu, 11 May 2023 16:31:31 -0600 Subject: [PATCH] feat: Make the multi better --- lib/test/host.test.ts | 2 +- lib/util/utils.ts | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/test/host.test.ts b/lib/test/host.test.ts index 6e036a1..1d2fcf0 100644 --- a/lib/test/host.test.ts +++ b/lib/test/host.test.ts @@ -8,7 +8,7 @@ describe("host", () => { test("Testing that the types work", () => { async function test(effects: Effects) { const utils = createUtils(effects) - const foo = utils.host.multi({ id: "foo" }) + const foo = utils.host.multi("foo") const fooOrigin = await foo.bindPort(80, { protocol: "http" as const }) const fooInterface = new NetworkInterfaceBuilder({ effects, diff --git a/lib/util/utils.ts b/lib/util/utils.ts index 6222cef..987a72b 100644 --- a/lib/util/utils.ts +++ b/lib/util/utils.ts @@ -50,9 +50,9 @@ export type Utils = { getSystemSmtp: () => GetSystemSmtp & WrapperOverWrite host: { of: (options: { kind: "static" | "single" | "multi"; id: string }) => Host - static: (options: { id: string }) => StaticHost - single: (options: { id: string }) => SingleHost - multi: (options: { id: string }) => MultiHost + static: (id: string) => StaticHost + single: (id: string) => SingleHost + multi: (id: string) => MultiHost } mountDependencies: < In extends @@ -120,11 +120,9 @@ export const utils = < host: { of: (options: { kind: "static" | "single" | "multi"; id: string }) => new Host({ ...options, effects }), - static: (options: { id: string }) => - new StaticHost({ ...options, effects }), - single: (options: { id: string }) => - new SingleHost({ ...options, effects }), - multi: (options: { id: string }) => new MultiHost({ ...options, effects }), + static: (id: string) => new StaticHost({ id, effects }), + single: (id: string) => new SingleHost({ id, effects }), + multi: (id: string) => new MultiHost({ id, effects }), }, readFile: (fileHelper: FileHelper) => fileHelper.read(effects), writeFile: (fileHelper: FileHelper, data: A) =>