Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/web/tests/viget-plugins.test.mjs
blob: 739ac6d8e1d5c38531844fa30004871f3e70e5b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1

import assert from "node:assert/strict";
import { test } from "node:test";
import {
  gradlePlugins,
  pluginDeclaration,
  pluginText,
  tazelPlugin,
} from "../lib/viget-plugins.ts";

const locales = ["en-US", "de-DE", "ru-RU", "he-IL"];

test("the plugin pages have every text in every language", () => {
  for (const locale of locales) {
    for (const [key, value] of Object.entries(pluginText(locale))) {
      assert.ok(value.trim().length > 0, `${locale} ${key}`);
    }
    for (const plugin of gradlePlugins) {
      assert.ok(
        plugin.description[locale].length > 0,
        `${locale} ${plugin.id}`,
      );
    }
  }
});

test("the declaration is the plugins block Tazel reads", () => {
  assert.equal(
    pluginDeclaration({ publisher: "Progmasoft", name: "CMake" }, "0.1.0"),
    [
      "plugins {",
      '  plugin("Progmasoft") {',
      '    name = "CMake"',
      '    version = "0.1.0"',
      "  }",
      "}",
    ].join("\n"),
  );
});

test("the Gradle catalog lists the Tazel plugin builder", () => {
  assert.deepEqual(
    gradlePlugins.map((plugin) => plugin.id),
    ["com.progmasoft.tazel.plugin"],
  );
});

test("a plugin page asks the API only for names that are identifiers", async () => {
  assert.equal(await tazelPlugin("../etc", "passwd"), null);
  assert.equal(await tazelPlugin("Progmasoft", "c-make"), null);
});