mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-13 18:17:00 +01:00
* feat: add test integration for pi-hole * refactor: test integration for pi-hole * fix: multiple secrets of same type could be used for integration creation * fix: remove integration test connection test and add mock for test-connection function * fix: add missing onUpdateFn to mysql integration secrets * fix: format issues * feat: add home assistant test connection * fix: deepsource issues * test: add system integration tests for test connection * fix: add before all for pulling home assistant image * test: add unit tests for handleTestConnectionResponseAsync * test: add unit test for testConnectionAsync * test: add mroe tests to integration-test-connection * fix: deepsource issues * fix: deepsource issue * chore: address pull request feedback
27 lines
736 B
TypeScript
27 lines
736 B
TypeScript
import { FlattenError } from "@homarr/common";
|
|
import { z } from "@homarr/validation";
|
|
|
|
import type { TestConnectionError } from "./integration";
|
|
|
|
export class IntegrationTestConnectionError extends FlattenError {
|
|
constructor(
|
|
public key: TestConnectionError["key"],
|
|
public detailMessage?: string,
|
|
) {
|
|
super("Checking integration connection failed", { key, message: detailMessage });
|
|
}
|
|
}
|
|
|
|
const schema = z.object({
|
|
key: z.custom<TestConnectionError["key"]>((value) => z.string().parse(value)),
|
|
message: z.string().optional(),
|
|
});
|
|
export const convertIntegrationTestConnectionError = (error: unknown) => {
|
|
const result = schema.safeParse(error);
|
|
if (!result.success) {
|
|
return;
|
|
}
|
|
|
|
return result.data;
|
|
};
|