flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/services/runner/src/hosted.test.ts

28 lines1,117 bytesCodeBlame
1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { hostedOpen, listedWorkspaces } from "./hosted.ts";
5
6const live = { enabled: true, live: true };
7const testMode = { enabled: true, live: false };
8const none = { enabled: false, live: false };
9
10test("listed workspaces use hosted models whatever billing is", () => {
11 assert.equal(hostedOpen("flagon-io", "flagon-io", testMode), true);
12 assert.equal(hostedOpen("Flagon-IO", " flagon-io , acme", none), true);
13 assert.equal(hostedOpen("anyone", "*", testMode), true);
14});
15
16test("with a test key a card check opens nothing: other workspaces bring their own provider", () => {
17 assert.equal(hostedOpen("acme", "flagon-io", testMode), false);
18 assert.equal(hostedOpen("acme", "flagon-io", none), false);
19 assert.equal(hostedOpen("acme", "", testMode), false);
20});
21
22test("once billing takes real money, every workspace may use them", () => {
23 assert.equal(hostedOpen("acme", "flagon-io", live), true);
24});
25
26test("the setting is a comma-separated list", () => {
27 assert.deepEqual(listedWorkspaces(" a, B ,,*"), ["a", "b", "*"]);
28});