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/apps/web/app/lib/mention.test.ts

22 lines748 bytesCodeBlame

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.

Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { partialMention } from "./mention.ts";
5
6test("an @ that could become @g1t-agent is offered", () => {
7 assert.equal(partialMention("@", 1), 0);
8 assert.equal(partialMention("thanks @g1", 10), 7);
9 assert.equal(partialMention("(@G1T-a", 7), 1);
10 assert.equal(partialMention("line\n@g1t-agen", 14), 5);
11});
12
13test("anything else is not", () => {
14 // Already complete.
15 assert.equal(partialMention("@g1t-agent", 10), null);
16 // Another name.
17 assert.equal(partialMention("@ana", 4), null);
18 // An email address.
19 assert.equal(partialMention("me@g1", 5), null);
20 // The caret is not at the end of it.
21 assert.equal(partialMention("@g1 later", 9), null);
22});