Skip to content

Commit 5370b7a

Browse files
authored
fix: DNS, add public suffix support, remove 2 underscores from txt (#4124)
## Description - [x] - Todo Backward compatibility in SaaS ref #2744 closes #3124 Corresponding SaaS PR must be merged on Release ## Steps for reproduction <img width="979" alt="image" src="https://github.com/user-attachments/assets/ac73026d-610a-42b5-a493-a37442501d76"> <img width="339" alt="image" src="https://github.com/user-attachments/assets/4e0061e5-6c83-482d-8c23-6b76063d93e0"> https://new-txt.poke-method.work/ See test for public suffix. ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent ffa7147 commit 5370b7a

File tree

3 files changed

+5112
-13
lines changed

3 files changed

+5112
-13
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { describe, test, expect } from "@jest/globals";
2+
3+
import { extractCname } from "./cname";
4+
5+
describe("extractCname from ordinary domains", () => {
6+
test('should return "@" for top level like domains', () => {
7+
expect(extractCname("example")).toBe("@");
8+
});
9+
10+
test('should return "@" for root level domains', () => {
11+
expect(extractCname("example.com")).toBe("@");
12+
});
13+
14+
test("should return the subdomain", () => {
15+
expect(extractCname("sub.example.com")).toBe("sub");
16+
});
17+
18+
test("should return all subdomains", () => {
19+
expect(extractCname("sub.sub.example.com")).toBe("sub.sub");
20+
});
21+
});
22+
23+
describe("extractCname from public suffix domains", () => {
24+
test('should return "@"', () => {
25+
expect(extractCname("co.za")).toBe("@");
26+
});
27+
28+
test('should return "@"', () => {
29+
expect(extractCname("example.co.za")).toBe("@");
30+
});
31+
32+
test("should return all the subdomain", () => {
33+
expect(extractCname("sub.example.co.za")).toBe("sub");
34+
});
35+
36+
test("should handle domains with multiple public suffixes correctly", () => {
37+
expect(extractCname("sub.sub.example.co.za")).toBe("sub.sub");
38+
});
39+
});

0 commit comments

Comments
 (0)