70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
36 lines
1004 B
TypeScript
36 lines
1004 B
TypeScript
import { describe, test } from "vitest";
|
|
import { partitionExports } from "../../src/config/exports";
|
|
import type { Exports } from "../../src/config/environment";
|
|
|
|
describe("partitionExports", () => {
|
|
test("returns empty partitions when exports are undefined", ({ expect }) => {
|
|
expect(partitionExports(undefined)).toEqual({
|
|
"durable-object": {},
|
|
worker: {},
|
|
});
|
|
});
|
|
|
|
test("returns empty partitions when exports are empty", ({ expect }) => {
|
|
expect(partitionExports({})).toEqual({
|
|
"durable-object": {},
|
|
worker: {},
|
|
});
|
|
});
|
|
|
|
test("partitions Durable Object and Worker exports by type", ({ expect }) => {
|
|
const exports: Exports = {
|
|
Counter: { type: "durable-object", storage: "sqlite" },
|
|
Admin: { type: "worker", cache: { enabled: true } },
|
|
};
|
|
|
|
expect(partitionExports(exports)).toEqual({
|
|
"durable-object": {
|
|
Counter: { type: "durable-object", storage: "sqlite" },
|
|
},
|
|
worker: {
|
|
Admin: { type: "worker", cache: { enabled: true } },
|
|
},
|
|
});
|
|
});
|
|
});
|