Files
pleno-vue/tests/unit/edge-gateway-service.spec.js
T

22 lines
1.2 KiB
JavaScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const source = readFileSync(join(process.cwd(), "src/services/edgeGateways.js"), "utf8");
describe("edge gateway service contract", () => {
it("wraps the v2 backend edge gateway REST endpoints", () => {
expect(source).toContain('"/departments"');
expect(source).toContain('"/edge-gateways"');
expect(source).toContain('"/edge-gateways/install-token"');
expect(source).toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/operations");
expect(source).toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/operations/${encodeURIComponent(operationId)}/events");
expect(source).toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/rotate-credentials");
expect(source).toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/discovery");
expect(source).toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/bindings");
expect(source).toContain("/departments/${encodeURIComponent(departmentId)}/gateway-cutover");
expect(source).not.toContain("/edge-gateways/${encodeURIComponent(gatewayId)}/shell-sessions");
});
});