Files
Test User 5152086668
CI / Docker build (push) Has been cancelled
CI / Frontend test and build (push) Has been cancelled
CI / Rust test (push) Has been cancelled
Release / Build and publish release (push) Has been cancelled
Initial browser fingerprint app with Gitea CI
2026-07-04 03:15:26 +08:00

28 lines
995 B
JavaScript

import assert from "node:assert/strict";
import { describe, it } from "node:test";
import {
DEFAULT_RECORDING_ENABLED,
RECORDING_COPY,
shouldRecordResult,
} from "../src/recording.mjs";
describe("recording preference", () => {
it("records anonymous data by default", () => {
assert.equal(DEFAULT_RECORDING_ENABLED, true);
assert.equal(shouldRecordResult(undefined), true);
assert.equal(shouldRecordResult(true), true);
assert.equal(shouldRecordResult(false), false);
});
it("uses user-facing copy that avoids submit wording", () => {
const visibleCopy = Object.values(RECORDING_COPY).join(" ");
assert.match(RECORDING_COPY.label, /共享匿名画像/);
assert.match(RECORDING_COPY.label, /复访识别/);
assert.match(RECORDING_COPY.hint, /第一阶段不发送数据/);
assert.match(RECORDING_COPY.hint, /指纹变化卡/);
assert.match(RECORDING_COPY.skipped, /未共享数据/);
assert.doesNotMatch(visibleCopy, /提交/);
});
});