All checks were successful
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-admin (push) Successful in 22s
Build and Push Docker Images / build-docs (push) Successful in 22s
Build and Push Docker Images / build-backend (push) Successful in 44s
Build and Push Docker Images / build-frontend (push) Successful in 1m13s
Build and Push Docker Images / build-central-services-api (push) Successful in 21s
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import test from "node:test"
|
|
import assert from "node:assert/strict"
|
|
|
|
import {
|
|
getBankAccountOwnerName,
|
|
isExpiredBankingError,
|
|
} from "../src/modules/cron/bankstatementsync.service"
|
|
|
|
test("reads the GoCardless owner_name for a bank account", () => {
|
|
assert.equal(
|
|
getBankAccountOwnerName({ owner_name: "Neue Firma GmbH" }),
|
|
"Neue Firma GmbH"
|
|
)
|
|
})
|
|
|
|
test("does not overwrite the stored owner with an empty provider value", () => {
|
|
assert.equal(getBankAccountOwnerName({ owner_name: "" }), null)
|
|
assert.equal(getBankAccountOwnerName({}), null)
|
|
assert.equal(getBankAccountOwnerName(null), null)
|
|
})
|
|
|
|
test("recognizes expired EUA errors from direct and central banking responses", () => {
|
|
assert.equal(isExpiredBankingError({ response: { data: { detail: "EUA was valid for 90 days and it expired" } } }), true)
|
|
assert.equal(isExpiredBankingError(new Error("EUA was valid for 90 days and it expired")), true)
|
|
assert.equal(isExpiredBankingError({ response: { data: { message: "temporary provider error" } } }), false)
|
|
})
|