Skip to content
28 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The sidebar asks billing whether it is on, not for the account, so no page waits on the card processor1import 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});

This file's history is long; its oldest lines are credited to the oldest commit read.