fix valid domain test for target, not source

This commit is contained in:
Wouter Groeneveld 2021-03-08 17:55:44 +01:00
parent b79f113fec
commit 2360186d5a
2 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ function validate(request) {
isValidUrl(request?.body?.source) &&
isValidUrl(request?.body?.target) &&
request?.body?.source !== request?.body?.target &&
isValidDomain(request?.body?.source)
isValidDomain(request?.body?.target)
}
async function isValidTargetUrl(target) {

View File

@ -20,12 +20,12 @@ describe("webmention receiver validate tests", () => {
expect(result).toBe(true)
})
test("is NOT valid if source is a valid url but not form valid domain", () => {
test("is NOT valid if target is a valid url but not form valid domain", () => {
const result = validate({
type: "application/x-www-form-urlencoded",
body: {
source: urlfrominvaliddomain,
target: validhttpsurl + "2"
source: validhttpsurl + "2",
target: urlfrominvaliddomain
}
})