test public entry point exports
This commit is contained in:
43
tests/index.test.ts
Normal file
43
tests/index.test.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { components, operations, paths } from "../src/index.js";
|
||||
import * as sdk from "../src/index.js";
|
||||
|
||||
type CapsuleSchema = components["schemas"]["Capsule"];
|
||||
type GetCapsuleOperation = operations["getCapsule"];
|
||||
type CapsulePath = paths["/v1/capsules/{id}"];
|
||||
|
||||
function acceptsGeneratedTypes(
|
||||
_capsule: CapsuleSchema,
|
||||
_operation: GetCapsuleOperation,
|
||||
_path: CapsulePath,
|
||||
): void {}
|
||||
|
||||
describe("public entry point", () => {
|
||||
it("exports the supported runtime API from the package root", () => {
|
||||
expect(sdk.Capsule).toBeTypeOf("function");
|
||||
expect(sdk.Sandbox).toBe(sdk.Capsule);
|
||||
expect(sdk.WrennClient).toBeTypeOf("function");
|
||||
expect(sdk.CodeInterpreter).toBeTypeOf("function");
|
||||
expect(sdk.Notebook).toBeTypeOf("function");
|
||||
expect(sdk.CommandManager).toBeTypeOf("function");
|
||||
expect(sdk.FileManager).toBeTypeOf("function");
|
||||
expect(sdk.Git).toBeTypeOf("function");
|
||||
expect(sdk.PtyManager).toBeTypeOf("function");
|
||||
expect(sdk.PtySession).toBeTypeOf("function");
|
||||
expect(sdk.WrennError).toBeTypeOf("function");
|
||||
expect(sdk.NotFoundError).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
it("keeps internal shared helpers out of the public runtime API", () => {
|
||||
expect("HttpClient" in sdk).toBe(false);
|
||||
expect("WsConnection" in sdk).toBe(false);
|
||||
});
|
||||
|
||||
it("exposes generated OpenAPI types from the package root", () => {
|
||||
acceptsGeneratedTypes(
|
||||
{} as CapsuleSchema,
|
||||
{} as GetCapsuleOperation,
|
||||
{} as CapsulePath,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user