Skip to content

Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演

3.9 KB
Raw Blame
import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";

const root = new URL("../", import.meta.url);

async function privacyPolicy() {
  return readFile(new URL("store/PRIVACY_POLICY.md", root), "utf8");
}

test("privacy policy discloses the current seven AI tasks and their external-media boundary", async () => {
  const policy = await privacyPolicy();
  for (const task of ["文字标签", "Skill 提炼", "创作规划", "图片分析", "视频分析", "图片生成", "视频生成"]) {
    assert.match(policy, new RegExp(task));
  }
  assert.match(policy, /用户选择的第三方 AI 服务/);
  assert.match(policy, /自定义兼容接口/);
  assert.match(policy, /图片、视频/);
  assert.match(policy, /只发送完成当前任务所必需、且由用户明确选择、提交或按其查询和参考意图读取的内容/);
  assert.match(policy, /不会发送整库或全部案例/);
  assert.match(policy, /仅在用户要求查询或参考案例库时调用本地工具/);
  assert.match(policy, /按需读取文字并展示来源/);
  assert.match(policy, /关闭状态在刷新后保留/);
  assert.match(policy, /检索不会自动发送案例图片、视频或原始文档文件/);
});

test("privacy policy makes the two independent execution confirmations explicit", async () => {
  const policy = await privacyPolicy();
  assert.match(policy, /发送授权.*所有真实外部请求.*前置条件/);
  assert.match(policy, /单次付费确认.*当前操作/);
  assert.match(policy, /两者不能互相替代/);
});

test("privacy policy discloses that composer text-only mode reads and sends zero images", async () => {
  const policy = await privacyPolicy();
  assert.match(policy, /新建创作会话默认只使用文字资料/);
  assert.match(policy, /明确开启原图或视频参考/);
  assert.match(policy, /未开启时不会因引用案例而读取、分析或发送其媒体原件/);
});

test("privacy policy accurately declares local-first handling and manifest permissions", async () => {
  const [policy, manifestSource] = await Promise.all([
    privacyPolicy(),
    readFile(new URL("extension/manifest.json", root), "utf8")
  ]);
  const manifest = JSON.parse(manifestSource);
  assert.match(policy, /本地优先/);
  assert.match(policy, /不提供开发者服务器/);
  assert.match(policy, /不出售用户数据/);
  for (const permission of [...manifest.permissions, ...manifest.optional_permissions]) {
    assert.match(policy, new RegExp("`" + permission + "`"), `policy must disclose ${permission}`);
  }
  for (const origin of manifest.host_permissions) {
    assert.ok(policy.includes(`\`${origin}\``), `policy must disclose ${origin}`);
  }
  assert.match(policy, /`<all_urls>`/);
});

test("privacy policy states the Chrome Web Store Limited Use boundary", async () => {
  const policy = await privacyPolicy();
  assert.match(policy, /Chrome Web Store User Data Policy/);
  assert.match(policy, /Limited Use/);
  assert.match(policy, /不会将用户数据用于个性化广告/);
  assert.match(policy, /不会允许人工读取用户数据/);
});

test("privacy policy explains corrected article regions and safe download handling", async () => {
  const policy = await privacyPolicy();
  assert.match(policy, /本地识别正文与媒体并展示预览/);
  assert.match(policy, /直接点选内容、添加遗漏内容、排除错误内容或撤销调整/);
  assert.match(policy, /“保存案例”按钮是当前内容方案的最终授权/);
  assert.match(policy, /“只保存正文”/);
  assert.match(policy, /PDF、Markdown、SKILL\.md、TXT、HTML 和 RTF/);
  assert.match(policy, /只有属于用户最终保存方案时/);
  assert.match(policy, /真实文件类型和容量限制/);
  assert.match(policy, /压缩包、程序和未知类型文件不会自动下载/);
  assert.match(policy, /失败时只保留原始来源链接/);
});