@decocms/blocks 7.77.11 → 7.77.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,8 +27,8 @@ describe("splitExactRedirects", () => {
27
27
  });
28
28
 
29
29
  expect(exact).toEqual([
30
- { path: "/old", to: "/new", status: 301 },
31
- { path: "/tmp", to: "/other", status: 302 },
30
+ { path: "/old", from: "/old", to: "/new", status: 301 },
31
+ { path: "/tmp", from: "/tmp", to: "/other", status: 307 },
32
32
  ]);
33
33
  // Block had nothing but exact rules ⇒ gone entirely, not an empty husk.
34
34
  expect(blocks.r).toBeUndefined();
@@ -71,9 +71,9 @@ describe("splitExactRedirects", () => {
71
71
  redirect: { from: "https://site.com/Old/", to: "/new" },
72
72
  },
73
73
  });
74
- // Origin stripped, trailing slash dropped, lower-cased — whatever the
75
- // writer keys by, the request-time lookup must produce byte for byte.
76
- expect(exact).toEqual([{ path: "/old", to: "/new", status: 302 }]);
74
+ // Folded key (the request-time lookup produces the same byte for byte, in
75
+ // either semantics); the source as written rides along for `"fresh"`.
76
+ expect(exact).toEqual([{ path: "/old", from: "/Old/", to: "/new", status: 307 }]);
77
77
  });
78
78
 
79
79
  it("drops the singular `redirect` field when rebuilding a block", () => {
@@ -99,7 +99,9 @@ describe("splitExactRedirects", () => {
99
99
  a: { __resolveType: "website/loaders/redirects.ts", redirects: [{ from: "/x", to: "/1" }] },
100
100
  b: { __resolveType: "website/loaders/redirects.ts", redirects: [{ from: "/x", to: "/2" }] },
101
101
  };
102
- expect(splitExactRedirects(input).exact).toEqual([{ path: "/x", to: "/2", status: 302 }]);
102
+ expect(splitExactRedirects(input).exact).toEqual([
103
+ { path: "/x", from: "/x", to: "/2", status: 307 },
104
+ ]);
103
105
  expect(loadRedirects(input).exact.get("/x")?.to).toBe("/2");
104
106
  });
105
107
 
@@ -120,7 +122,7 @@ describe("splitExactRedirects", () => {
120
122
  // Exact left the decofile...
121
123
  expect(matchRedirect("/a", after)).toBeNull();
122
124
  // ...into the extracted list, unchanged.
123
- expect(exact).toContainEqual({ path: "/a", to: "/1", status: 301 });
125
+ expect(exact).toContainEqual({ path: "/a", from: "/a", to: "/1", status: 301 });
124
126
  // Globs still match exactly as before.
125
127
  expect(matchRedirect("/b/deep", after)).toEqual(matchRedirect("/b/deep", before));
126
128
  });