-
Notifications
You must be signed in to change notification settings - Fork 417
Expand file tree
/
Copy pathserver-function.cy.ts
More file actions
55 lines (54 loc) · 2.37 KB
/
server-function.cy.ts
File metadata and controls
55 lines (54 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
describe("server-function", () => {
it("should have isServer true in the server function - nested", () => {
cy.visit("/is-server-nested");
cy.get("#server-fn-test").contains('{"serverFnWithIsServer":true}');
});
it("should have isServer true in the server function - const", () => {
cy.visit("/is-server-const");
cy.get("#server-fn-test").contains('{"serverFnWithIsServer":true}');
});
it("should have an id of type string in the server function meta - nested", () => {
cy.visit("/server-function-meta-nested");
cy.get("#server-fn-test").contains('{"serverFnWithMeta":"string"}');
});
it("should externalize node builtin in server function - nested", () => {
cy.visit("/node-builtin-nested");
cy.get("#server-fn-test").contains('{"serverFnWithNodeBuiltin":"can/externalize"}');
});
it("should externalize npm module in server function - nested", () => {
cy.visit("npm-module-nested");
cy.get("#server-fn-test").contains('{"serverFnWithNpmModule":[2,4,6]}');
});
it("should have isServer true in the server function - toplevel", () => {
cy.visit("/is-server-toplevel");
cy.get("#server-fn-test").contains('{"serverFnWithIsServer":true}');
});
it("should have an id of type string in the server function meta - toplevel", () => {
cy.visit("/server-function-meta");
cy.get("#server-fn-test").contains('{"serverFnWithMeta":"string"}');
});
it("should externalize node builtin in server function - toplevel", () => {
cy.visit("/node-builtin-toplevel");
cy.get("#server-fn-test").contains('{"serverFnWithNodeBuiltin":"can/externalize"}');
});
it("should externalize npm module in server function - toplevel", () => {
cy.visit("npm-module-toplevel");
cy.get("#server-fn-test").contains('{"serverFnWithNpmModule":[2,4,6]}');
});
it("should throw a 404 if function is not found", () => {
cy.request({
url: "/_server/?name='not-found-function'",
failOnStatusCode: false
})
.its("status")
.should("eq", 404);
});
it("should build when anon default export and server functions", () => {
cy.visit("is-server-with-anon-default-export");
cy.get("#server-fn-test").contains('{"serverFnWithIsServer":true}');
});
it("should build with generator as server function", () => {
cy.visit("/generator-server-function");
cy.get("#server-fn-test").contains('¡Hola, Mundo!');
});
});