ken_nogi/NodeSrv/apps/lineworks-user-auth/test/adminView.test.js
Kenichiro NOGI ce58cb4be4 初回コミット: dev配下(NodeSrv/Pleasanter等)をGitea管理下に統合
GitHub(nextgroup2706/ken_nogi)は今後使わず自社Gitea運用に切替え。
NodeSrvは旧リポジトリの履歴を破棄しファイルのみ統合(Dokploy用サービスアカウントは
別途mygit-admin/NodeSrv.gitに履歴あり)。notepmエクスポート(12GB)とPleasanter
インストーラzip(208MB)はサイズが大きいため.gitignoreで除外。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:37:06 +09:00

41 lines
1.8 KiB
JavaScript

const { test } = require("node:test");
const assert = require("node:assert");
const { renderLoginPage, renderDashboardPage, renderTempKeyPage } = require("../src/adminView");
test("renderLoginPage includes a master key input form", () => {
const html = renderLoginPage();
assert.ok(html.includes('name="masterKey"'));
assert.ok(html.includes("<form"));
});
test("renderLoginPage includes the given error message when provided", () => {
const html = renderLoginPage("Master Keyが正しくありません");
assert.ok(html.includes("Master Keyが正しくありません"));
});
test("renderDashboardPage lists each record's key, account, and status", () => {
const html = renderDashboardPage({
records: [{ key: "lineworks-form-sync", account: "svc@example.co.jp", status: "有効", expiresAt: "2026-08-24T01:00:00.000Z" }],
message: null,
});
assert.ok(html.includes("lineworks-form-sync"));
assert.ok(html.includes("svc@example.co.jp"));
assert.ok(html.includes("有効"));
});
test("renderDashboardPage includes a new-registration form with only an account field (連携キーはアカウントのローカル部から自動生成、入力不要)", () => {
const html = renderDashboardPage({ records: [], message: null });
assert.ok(html.includes('name="account"'));
assert.ok(!html.includes('name="key"'));
});
test("renderDashboardPage includes a temp-key issuance button (Master Keyを共有せずに済む導線)", () => {
const html = renderDashboardPage({ records: [], message: null });
assert.ok(html.includes('action="/auth/temp-key"'));
});
test("renderTempKeyPage shows the shareable one-time login URL", () => {
const html = renderTempKeyPage({ url: "https://lwauth29.next-hd.net/auth/login?tempKey=abc" });
assert.ok(html.includes("https://lwauth29.next-hd.net/auth/login?tempKey=abc"));
});