Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
import { formatOperatorError } from "./operatorError.ts";
|
||||
|
||||
describe("formatOperatorError", () => {
|
||||
it("turns an HTML or JSON parser response into operator copy", () => {
|
||||
const result = formatOperatorError(
|
||||
new Error("Unexpected token '<', \"<!doctype html>\" is not valid JSON"),
|
||||
"Operations map laden mislukt.",
|
||||
);
|
||||
|
||||
assert.equal(result, "Operations map laden mislukt. De backendbron gaf geen geldige API-respons.");
|
||||
assert.doesNotMatch(result, /doctype|unexpected token/i);
|
||||
});
|
||||
|
||||
it("keeps a concise backend message", () => {
|
||||
assert.equal(formatOperatorError(new Error("Portainer is niet bereikbaar."), "Laden mislukt."), "Portainer is niet bereikbaar.");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user