Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

test(license): pin the machine noun so the copy suites pass on a Mac too

enes6d964244f607
diff --git a/src/renderer/components/settings/sections/LicenseSection.test.tsx b/src/renderer/components/settings/sections/LicenseSection.test.tsx
index f4f4aff38..6760fff9b 100644
--- a/src/renderer/components/settings/sections/LicenseSection.test.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.test.tsx
@@ -5,6 +5,7 @@
// which sentence lands beside which data, what a destructive button does before it does it, and
// whether a failed ACTION is reported as a failed READ.
import { describe, it, expect, beforeEach, afterEach, vi, type Mock } from 'vitest'
+import { pinNeutralMachineNoun } from '@renderer/lib/testMachineNoun'
import { act } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import type { LicenseDetail, LicenseStatus } from '@shared/types'
@@ -95,6 +96,10 @@ afterEach(() => {
vi.unstubAllGlobals()
})
+
+// See testMachineNoun.ts: the rendered copy names the machine, so the host OS is pinned.
+pinNeutralMachineNoun()
+
describe('LicenseSection — a release that did not land', () => {
it('reports the RELEASE, and keeps saying the truth about the license', async () => {
await mount(PRO)
diff --git a/src/renderer/lib/accountPresentation.test.ts b/src/renderer/lib/accountPresentation.test.ts
index a4adc27e5..f15f27b0b 100644
--- a/src/renderer/lib/accountPresentation.test.ts
+++ b/src/renderer/lib/accountPresentation.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, it } from 'vitest'
+import { pinNeutralMachineNoun } from './testMachineNoun'
import { presentAccount } from './accountPresentation'
+
+// The copy under test names the machine, and `machineNoun()` sniffs the host — pin it so the
+// literals below hold on a Mac too (see testMachineNoun.ts).
+pinNeutralMachineNoun()
+
describe('presentAccount', () => {
it('uses a chosen name before the email and identifies a local login', () => {
expect(presentAccount({ label: 'Work', email: '[email protected]' })).toEqual({
diff --git a/src/renderer/lib/licenseCopy.test.ts b/src/renderer/lib/licenseCopy.test.ts
index 6b4d3be31..f63a4d73d 100644
--- a/src/renderer/lib/licenseCopy.test.ts
+++ b/src/renderer/lib/licenseCopy.test.ts
@@ -1,4 +1,5 @@
import { describe, it, expect } from 'vitest'
+import { pinNeutralMachineNoun } from './testMachineNoun'
import type { LicenseDetail } from '@shared/types'
import {
licenseSentence,
@@ -23,6 +24,11 @@ const keygen = (over: Partial<LicenseDetail> = {}): LicenseDetail => ({
...over
})
+
+// The copy under test names the machine, and `machineNoun()` sniffs the host — pin it so the
+// literals below hold on a Mac too (see testMachineNoun.ts).
+pinNeutralMachineNoun()
+
describe('licenseSentence — a keygen license that read cleanly', () => {
it('reports usage against the cap and names phones as devices', () => {
const s = licenseSentence(keygen({ used: 2, seats: 3 }))
diff --git a/src/renderer/lib/testMachineNoun.ts b/src/renderer/lib/testMachineNoun.ts
new file mode 100644
index 000000000..8eea48ca7
--- /dev/null
+++ b/src/renderer/lib/testMachineNoun.ts
@@ -0,0 +1,27 @@
+/**
+ * TEST-ONLY — pin the machine noun so copy assertions do not depend on the DEVELOPER'S OS.
+ *
+ * `machineNoun()` sniffs `navigator`, so a string built through it reads "this computer" on the
+ * Linux CI box and "this Mac" on a Mac. Three suites asserted the Linux answer as a literal and
+ * were therefore red on every macOS checkout — reported by a contributor whose branch touched
+ * none of those files (PR #592), which is the expensive way to find out: a test that fails only
+ * on the maintainer's own platform teaches contributors to ignore red.
+ *
+ * Pinning the platform is the fix rather than softening the assertions: the exact sentence is the
+ * thing under test (issue #563 is about billing copy naming the wrong machine), so it must stay a
+ * literal — what must not stay is the assumption about which machine is running the suite.
+ */
+import { afterAll, beforeAll } from 'vitest'
+
+/** Force `machineNoun()` to answer 'computer' for the whole file (jsdom `navigator.platform`). */
+export function pinNeutralMachineNoun(): void {
+ let original: PropertyDescriptor | undefined
+ beforeAll(() => {
+ original = Object.getOwnPropertyDescriptor(navigator, 'platform')
+ Object.defineProperty(navigator, 'platform', { value: 'Linux x86_64', configurable: true })
+ })
+ afterAll(() => {
+ if (original) Object.defineProperty(navigator, 'platform', original)
+ else delete (navigator as unknown as Record<string, unknown>).platform
+ })
+}