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>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
const { test } = require("node:test");
|
|
const assert = require("node:assert");
|
|
const { fetchUsers, fetchOrgUnits } = require("../src/lib/lineworksClient");
|
|
|
|
test("fetchUsers follows responseMetaData.nextCursor until it is null", async () => {
|
|
const pages = [
|
|
{ users: [{ userId: "u1" }], responseMetaData: { nextCursor: "cursor-2" } },
|
|
{ users: [{ userId: "u2" }], responseMetaData: { nextCursor: null } },
|
|
];
|
|
let call = 0;
|
|
const fetchImpl = async () => {
|
|
const body = pages[call++];
|
|
return { ok: true, json: async () => body };
|
|
};
|
|
|
|
const users = await fetchUsers({ accessToken: "tok", fetchImpl });
|
|
|
|
assert.strictEqual(call, 2);
|
|
assert.deepStrictEqual(users.map((u) => u.userId), ["u1", "u2"]);
|
|
});
|
|
|
|
test("fetchOrgUnits returns items directly when there is no next cursor", async () => {
|
|
const fetchImpl = async () => ({
|
|
ok: true,
|
|
json: async () => ({ orgUnits: [{ orgUnitId: "o1" }, { orgUnitId: "o2" }], responseMetaData: {} }),
|
|
});
|
|
const orgUnits = await fetchOrgUnits({ accessToken: "tok", fetchImpl });
|
|
assert.strictEqual(orgUnits.length, 2);
|
|
});
|