Skip to content

Commit

Permalink
Better test, remove unused func
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Jul 16, 2024
1 parent 7fc7f99 commit bb29b90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/middlewares/extractValidatedName.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function extractName(req) {
validateDomain(host);

const nonRootSubdomains = host.split(`.${config.rootDomain}`).find(Boolean);

const nameFromQueryOrBody = getNameFromReq(req);

let name = nameFromQueryOrBody;
Expand Down Expand Up @@ -67,13 +66,3 @@ function validateDomain(host) {
);
}
}

function validateAndReturnSubdomain(nonRootSubdomains) {
if (!nonRootSubdomains) {
throw new AppError(
422,
"The _ format requires a corresponding subdomain as the NIP-05 name."
);
}
return nonRootSubdomains;
}
8 changes: 7 additions & 1 deletion test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ describe("Nostr NIP 05 API tests", () => {
.send(userData)
.expect(200);

await request(app)
.get("/.well-known/webfinger")
.set("Host", "nos.social")
.query({ resource: "acctWRONG:[email protected]" })
.expect(422);

const getResponse = await request(app)
.get("/.well-known/webfinger")
.set("Host", "nos.social")
Expand Down Expand Up @@ -302,7 +308,7 @@ describe("Nostr NIP 05 API tests", () => {
});
});

it.only("should store and retrieve Nostr NIP 05 data through an empty subdomain", async () => {
it("should store and retrieve Nostr NIP 05 data through an empty subdomain", async () => {
const userData = createUserPayload({ name: "_" });

await request(app)
Expand Down

0 comments on commit bb29b90

Please sign in to comment.