@notionhq/custom-blocks 0.2.14 → 0.2.15
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.
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// @vitest-environment node
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { parseUploadsInput } from "./upload.js";
|
|
4
|
-
describe("parseUploadsInput", () => {
|
|
5
|
-
it("preserves signed headers and supports targets without headers", () => {
|
|
6
|
-
const targets = {
|
|
7
|
-
hello: {
|
|
8
|
-
uploadUrl: "https://example.com/bundle?signature=a%2Bb",
|
|
9
|
-
bundleDir: "/tmp/block",
|
|
10
|
-
headers: { "Content-Length": "42", "x-amz-tagging": "source=cli" },
|
|
11
|
-
},
|
|
12
|
-
legacy: {
|
|
13
|
-
uploadUrl: "https://example.com/legacy",
|
|
14
|
-
bundleDir: "/tmp/legacy",
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
expect(parseUploadsInput(JSON.stringify(targets))).toEqual(targets);
|
|
18
|
-
});
|
|
19
|
-
it.each([
|
|
20
|
-
"broken",
|
|
21
|
-
"null",
|
|
22
|
-
"[]",
|
|
23
|
-
"42",
|
|
24
|
-
'{"hello":null}',
|
|
25
|
-
'{"hello":{"bundleDir":"x"}}',
|
|
26
|
-
'{"hello":{"uploadUrl":"x"}}',
|
|
27
|
-
])("rejects malformed target input %s", raw => {
|
|
28
|
-
expect(() => parseUploadsInput(raw)).toThrow();
|
|
29
|
-
});
|
|
30
|
-
it.each([null, [], "bad", { "Content-Length": 42 }])("rejects invalid signed headers %j", headers => {
|
|
31
|
-
expect(() => parseUploadsInput(JSON.stringify({
|
|
32
|
-
hello: { uploadUrl: "x", bundleDir: "x", headers },
|
|
33
|
-
}))).toThrow("headers must be an object of string values");
|
|
34
|
-
});
|
|
35
|
-
});
|