Skip to content

Commit bb29b90

Browse files
committed
Better test, remove unused func
1 parent 7fc7f99 commit bb29b90

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/middlewares/extractValidatedName.js

-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ function extractName(req) {
1515
validateDomain(host);
1616

1717
const nonRootSubdomains = host.split(`.${config.rootDomain}`).find(Boolean);
18-
1918
const nameFromQueryOrBody = getNameFromReq(req);
2019

2120
let name = nameFromQueryOrBody;
@@ -67,13 +66,3 @@ function validateDomain(host) {
6766
);
6867
}
6968
}
70-
71-
function validateAndReturnSubdomain(nonRootSubdomains) {
72-
if (!nonRootSubdomains) {
73-
throw new AppError(
74-
422,
75-
"The _ format requires a corresponding subdomain as the NIP-05 name."
76-
);
77-
}
78-
return nonRootSubdomains;
79-
}

test/app.test.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ describe("Nostr NIP 05 API tests", () => {
261261
.send(userData)
262262
.expect(200);
263263

264+
await request(app)
265+
.get("/.well-known/webfinger")
266+
.set("Host", "nos.social")
267+
.query({ resource: "acctWRONG:[email protected]" })
268+
.expect(422);
269+
264270
const getResponse = await request(app)
265271
.get("/.well-known/webfinger")
266272
.set("Host", "nos.social")
@@ -302,7 +308,7 @@ describe("Nostr NIP 05 API tests", () => {
302308
});
303309
});
304310

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

308314
await request(app)

0 commit comments

Comments
 (0)