Download src/node-host/gateway-platform-identity.test.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/node-host/gateway-platform-identity.test.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/node-host/gateway-platform-identity.test.ts
-
curl -L -o gateway-platform-identity.test.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/node-host/gateway-platform-identity.test.ts
1.08 kB
| import { describe, expect, it, vi } from "vitest"; | |
| import { resolveNodeHostGatewayPlatformIdentity } from "./gateway-platform-identity.js"; | |
| describe("resolveNodeHostGatewayPlatformIdentity", () => { | |
| it.each([ | |
| { runtime: "darwin", platform: "macos", deviceFamily: "Mac", modelIdentifier: "Mac16,1" }, | |
| { runtime: "linux", platform: "linux", deviceFamily: "Linux", modelIdentifier: "Test Board" }, | |
| { runtime: "win32", platform: "windows", deviceFamily: "Windows", modelIdentifier: undefined }, | |
| { | |
| runtime: "freebsd", | |
| platform: "freebsd", | |
| deviceFamily: undefined, | |
| modelIdentifier: undefined, | |
| }, | |
| ] as const)( | |
| "reports $runtime hardware identity", | |
| ({ runtime, platform, deviceFamily, modelIdentifier }) => { | |
| const resolveModel = vi.fn(() => modelIdentifier); | |
| expect(resolveNodeHostGatewayPlatformIdentity(runtime, resolveModel)).toEqual({ | |
| platform, | |
| ...(deviceFamily ? { deviceFamily, modelIdentifier } : {}), | |
| }); | |
| expect(resolveModel).toHaveBeenCalledExactlyOnceWith(runtime); | |
| }, | |
| ); | |
| }); | |