@quintype/framework 7.19.1 → 7.19.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [7.19.2](https://github.com/quintype/quintype-node-framework/compare/v7.19.1...v7.19.2) (2023-05-09)
|
|
6
|
+
|
|
5
7
|
### [7.19.1](https://github.com/quintype/quintype-node-framework/compare/v7.19.0...v7.19.1) (2023-05-08)
|
|
6
8
|
|
|
7
9
|
## [7.19.0](https://github.com/quintype/quintype-node-framework/compare/v7.10.5...v7.19.0) (2023-05-08)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.19.
|
|
3
|
+
"version": "7.19.2",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
|
-
"@quintype/amp": "^2.
|
|
34
|
+
"@quintype/amp": "^2.11.0",
|
|
35
35
|
"@quintype/backend": "^2.3.3",
|
|
36
36
|
"@quintype/components": "^3.3.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
|
@@ -20,7 +20,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
20
20
|
res.setHeader(
|
|
21
21
|
"Content-Security-Policy",
|
|
22
22
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
23
|
-
`script-src '
|
|
23
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
24
24
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
25
25
|
`img-src data: https: http: blob:;` +
|
|
26
26
|
`font-src data: https: http:;` +
|
|
@@ -60,7 +60,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
60
60
|
res.setHeader(
|
|
61
61
|
"Content-Security-Policy",
|
|
62
62
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
63
|
-
`script-src '
|
|
63
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
64
64
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
65
65
|
`img-src data: https: http: blob:;` +
|
|
66
66
|
`font-src data: https: http:;` +
|
|
@@ -80,7 +80,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
80
80
|
res.setHeader(
|
|
81
81
|
"Content-Security-Policy",
|
|
82
82
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
83
|
-
`script-src '
|
|
83
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
84
84
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
85
85
|
`img-src data: https: http: blob:;` +
|
|
86
86
|
`font-src data: https: http:;` +
|
|
@@ -53,7 +53,8 @@ function createApp(loadData, routes, opts = {}, app = express()) {
|
|
|
53
53
|
describe("Isomorphic Handler", function () {
|
|
54
54
|
it("Renders the page if the route matches", function (done) {
|
|
55
55
|
const app = createApp(
|
|
56
|
-
(pageType, params, config, client, { host }) =>
|
|
56
|
+
(pageType, params, config, client, { host }) =>
|
|
57
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
57
58
|
[{ pageType: "home-page", path: "/", exact: true }]
|
|
58
59
|
);
|
|
59
60
|
|
|
@@ -63,7 +64,10 @@ describe("Isomorphic Handler", function () {
|
|
|
63
64
|
.expect(200)
|
|
64
65
|
.then((res) => {
|
|
65
66
|
const response = JSON.parse(res.text);
|
|
66
|
-
assert.equal(
|
|
67
|
+
assert.equal(
|
|
68
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
69
|
+
response.content
|
|
70
|
+
);
|
|
67
71
|
assert.equal("foobar", response.store.qt.data.text);
|
|
68
72
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
69
73
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -73,7 +77,8 @@ describe("Isomorphic Handler", function () {
|
|
|
73
77
|
|
|
74
78
|
it("Accepts an async pickComponent function", function (done) {
|
|
75
79
|
const app = createApp(
|
|
76
|
-
(pageType, params, config, client, { host }) =>
|
|
80
|
+
(pageType, params, config, client, { host }) =>
|
|
81
|
+
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
77
82
|
[{ pageType: "home-page", path: "/" }],
|
|
78
83
|
{
|
|
79
84
|
pickComponent: (pageType) => Promise.resolve(pickComponent(pageType)),
|
|
@@ -86,14 +91,18 @@ describe("Isomorphic Handler", function () {
|
|
|
86
91
|
.expect(200)
|
|
87
92
|
.then((res) => {
|
|
88
93
|
const response = JSON.parse(res.text);
|
|
89
|
-
assert.equal(
|
|
94
|
+
assert.equal(
|
|
95
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
96
|
+
response.content
|
|
97
|
+
);
|
|
90
98
|
})
|
|
91
99
|
.then(done);
|
|
92
100
|
});
|
|
93
101
|
|
|
94
102
|
it("Passes all URL parameters to the load data function", function (done) {
|
|
95
103
|
const app = createApp(
|
|
96
|
-
(pageType, params, config, client) =>
|
|
104
|
+
(pageType, params, config, client) =>
|
|
105
|
+
Promise.resolve({ pageType, data: { text: params.text } }),
|
|
97
106
|
[{ pageType: "home-page", path: "/" }]
|
|
98
107
|
);
|
|
99
108
|
|
|
@@ -111,7 +120,8 @@ describe("Isomorphic Handler", function () {
|
|
|
111
120
|
describe("preloading", function () {
|
|
112
121
|
it("preloads the app.js", function (done) {
|
|
113
122
|
const app = createApp(
|
|
114
|
-
(pageType, params, config, client) =>
|
|
123
|
+
(pageType, params, config, client) =>
|
|
124
|
+
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
115
125
|
[{ pageType: "home-page", path: "/" }],
|
|
116
126
|
{
|
|
117
127
|
preloadJs: true,
|
|
@@ -145,7 +155,10 @@ describe("Isomorphic Handler", function () {
|
|
|
145
155
|
.expect(404)
|
|
146
156
|
.then((res) => {
|
|
147
157
|
const response = JSON.parse(res.text);
|
|
148
|
-
assert.equal(
|
|
158
|
+
assert.equal(
|
|
159
|
+
'<div data-page-type="not-found">foobar</div>',
|
|
160
|
+
response.content
|
|
161
|
+
);
|
|
149
162
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
150
163
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
151
164
|
})
|
|
@@ -173,7 +186,10 @@ describe("Isomorphic Handler", function () {
|
|
|
173
186
|
.expect(500)
|
|
174
187
|
.then((res) => {
|
|
175
188
|
const response = JSON.parse(res.text);
|
|
176
|
-
assert.equal(
|
|
189
|
+
assert.equal(
|
|
190
|
+
'<div data-page-type="not-found">foobar</div>',
|
|
191
|
+
response.content
|
|
192
|
+
);
|
|
177
193
|
assert.equal(true, response.store.qt.disableIsomorphicComponent);
|
|
178
194
|
})
|
|
179
195
|
.then(done, done);
|
|
@@ -208,7 +224,10 @@ describe("Isomorphic Handler", function () {
|
|
|
208
224
|
supertest(app)
|
|
209
225
|
.get("/")
|
|
210
226
|
.expect("Content-Type", /html/)
|
|
211
|
-
.expect(
|
|
227
|
+
.expect(
|
|
228
|
+
"Cache-Control",
|
|
229
|
+
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
230
|
+
)
|
|
212
231
|
.expect("Vary", "Accept-Encoding")
|
|
213
232
|
.expect("Surrogate-Key", "foo bar")
|
|
214
233
|
.expect("Cache-Tag", "foo,bar")
|
|
@@ -217,7 +236,8 @@ describe("Isomorphic Handler", function () {
|
|
|
217
236
|
|
|
218
237
|
it("it redirects on a 301", function (done) {
|
|
219
238
|
const app = createApp(
|
|
220
|
-
(pageType, params, config, client) =>
|
|
239
|
+
(pageType, params, config, client) =>
|
|
240
|
+
Promise.resolve({ httpStatusCode: 301, data: { location: "/foobar" } }),
|
|
221
241
|
[{ pageType: "home-page", path: "/" }]
|
|
222
242
|
);
|
|
223
243
|
|
|
@@ -226,7 +246,8 @@ describe("Isomorphic Handler", function () {
|
|
|
226
246
|
|
|
227
247
|
it("returns a 500 if render layout crashes", function (done) {
|
|
228
248
|
const app = createApp(
|
|
229
|
-
(pageType, params, config, client) =>
|
|
249
|
+
(pageType, params, config, client) =>
|
|
250
|
+
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
230
251
|
[{ pageType: "home-page", path: "/" }],
|
|
231
252
|
{
|
|
232
253
|
renderLayout: () => {
|
|
@@ -246,7 +267,8 @@ describe("Isomorphic Handler", function () {
|
|
|
246
267
|
});
|
|
247
268
|
|
|
248
269
|
const app = createApp(
|
|
249
|
-
(pageType, params, config, client) =>
|
|
270
|
+
(pageType, params, config, client) =>
|
|
271
|
+
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
250
272
|
[{ pageType: "home-page", path: "/" }],
|
|
251
273
|
{
|
|
252
274
|
prerenderServiceUrl: "http://localhost:4000",
|
|
@@ -315,7 +337,10 @@ describe("Isomorphic Handler", function () {
|
|
|
315
337
|
.expect(404)
|
|
316
338
|
.then((res) => {
|
|
317
339
|
const response = JSON.parse(res.text);
|
|
318
|
-
assert.equal(
|
|
340
|
+
assert.equal(
|
|
341
|
+
'<div data-page-type="not-found">foobar</div>',
|
|
342
|
+
response.content
|
|
343
|
+
);
|
|
319
344
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
320
345
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
321
346
|
})
|
|
@@ -324,7 +349,8 @@ describe("Isomorphic Handler", function () {
|
|
|
324
349
|
|
|
325
350
|
it("Allows bypassing even data.abort is set", function (done) {
|
|
326
351
|
const app = createApp(
|
|
327
|
-
(pageType, params, config, client, { next }) =>
|
|
352
|
+
(pageType, params, config, client, { next }) =>
|
|
353
|
+
next().then((n) => ({ data: n })),
|
|
328
354
|
[{ pageType: "home-page", path: "/skip", exact: true }],
|
|
329
355
|
{
|
|
330
356
|
loadErrorData: (err, config, client, { host }) => ({
|
|
@@ -341,7 +367,10 @@ describe("Isomorphic Handler", function () {
|
|
|
341
367
|
.expect(404)
|
|
342
368
|
.then((res) => {
|
|
343
369
|
const response = JSON.parse(res.text);
|
|
344
|
-
assert.equal(
|
|
370
|
+
assert.equal(
|
|
371
|
+
'<div data-page-type="not-found">foobar</div>',
|
|
372
|
+
response.content
|
|
373
|
+
);
|
|
345
374
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
346
375
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
347
376
|
})
|
|
@@ -354,7 +383,9 @@ describe("Isomorphic Handler", function () {
|
|
|
354
383
|
{ pageType: "home-page", path: "/" },
|
|
355
384
|
];
|
|
356
385
|
const dataLoader = (pageType, _1, _2, _3, { host, next }) =>
|
|
357
|
-
pageType === "skip"
|
|
386
|
+
pageType === "skip"
|
|
387
|
+
? next()
|
|
388
|
+
: Promise.resolve({ pageType, data: { text: "foobar", host } });
|
|
358
389
|
|
|
359
390
|
const app = createApp(dataLoader, overlappingRoutes);
|
|
360
391
|
|
|
@@ -364,7 +395,10 @@ describe("Isomorphic Handler", function () {
|
|
|
364
395
|
.expect(200)
|
|
365
396
|
.then((res) => {
|
|
366
397
|
const response = JSON.parse(res.text);
|
|
367
|
-
assert.equal(
|
|
398
|
+
assert.equal(
|
|
399
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
400
|
+
response.content
|
|
401
|
+
);
|
|
368
402
|
assert.equal("foobar", response.store.qt.data.text);
|
|
369
403
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
370
404
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -375,7 +409,8 @@ describe("Isomorphic Handler", function () {
|
|
|
375
409
|
|
|
376
410
|
it("Passes the primaryHostUrl and currentHostUrl to the render", function (done) {
|
|
377
411
|
const app = createApp(
|
|
378
|
-
(pageType, params, config, client, { host }) =>
|
|
412
|
+
(pageType, params, config, client, { host }) =>
|
|
413
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
379
414
|
[{ pageType: "home-page", path: "/" }]
|
|
380
415
|
);
|
|
381
416
|
|
|
@@ -410,7 +445,10 @@ describe("Isomorphic Handler", function () {
|
|
|
410
445
|
.expect("Content-Type", /html/)
|
|
411
446
|
.expect(200)
|
|
412
447
|
.then((res) => {
|
|
413
|
-
assert.equal(
|
|
448
|
+
assert.equal(
|
|
449
|
+
`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`,
|
|
450
|
+
res.get("X-QT-Light-Pages-Url")
|
|
451
|
+
);
|
|
414
452
|
})
|
|
415
453
|
.then(done);
|
|
416
454
|
});
|
|
@@ -433,7 +471,10 @@ describe("Isomorphic Handler", function () {
|
|
|
433
471
|
.expect("Content-Type", /html/)
|
|
434
472
|
.expect(200)
|
|
435
473
|
.then((res) => {
|
|
436
|
-
assert.equal(
|
|
474
|
+
assert.equal(
|
|
475
|
+
`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`,
|
|
476
|
+
res.get("X-QT-Light-Pages-Url")
|
|
477
|
+
);
|
|
437
478
|
})
|
|
438
479
|
.then(done);
|
|
439
480
|
});
|
|
@@ -448,7 +489,8 @@ describe("Isomorphic Handler", function () {
|
|
|
448
489
|
[{ pageType: "story-page", path: "/*/:storySlug" }],
|
|
449
490
|
{
|
|
450
491
|
lightPages: () => false,
|
|
451
|
-
renderLightPage: (req, res, result) =>
|
|
492
|
+
renderLightPage: (req, res, result) =>
|
|
493
|
+
res.send("<h1> Amp Page </h1>"),
|
|
452
494
|
shouldEncodeAmpUri: true,
|
|
453
495
|
}
|
|
454
496
|
);
|
|
@@ -511,7 +553,10 @@ describe("Isomorphic Handler", function () {
|
|
|
511
553
|
.then((res) => {
|
|
512
554
|
const cacheControl = res.header["cache-control"];
|
|
513
555
|
const cacheTag = res.header["cache-tag"];
|
|
514
|
-
assert.equal(
|
|
556
|
+
assert.equal(
|
|
557
|
+
cacheControl,
|
|
558
|
+
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
559
|
+
);
|
|
515
560
|
assert.equal(cacheTag, "c/1/abcdefgh");
|
|
516
561
|
})
|
|
517
562
|
.then(done);
|
|
@@ -534,7 +579,10 @@ describe("Isomorphic Handler", function () {
|
|
|
534
579
|
.then((res) => {
|
|
535
580
|
const cacheControl = res.header["cache-control"];
|
|
536
581
|
const cacheTag = res.header["cache-tag"];
|
|
537
|
-
assert.equal(
|
|
582
|
+
assert.equal(
|
|
583
|
+
cacheControl,
|
|
584
|
+
"public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
585
|
+
);
|
|
538
586
|
assert.equal(cacheTag, undefined);
|
|
539
587
|
})
|
|
540
588
|
.then(done);
|
|
@@ -568,7 +616,7 @@ describe("Isomorphic Handler", function () {
|
|
|
568
616
|
assert.equal(
|
|
569
617
|
contentSecurityPolicy,
|
|
570
618
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
571
|
-
`script-src '
|
|
619
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
572
620
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
573
621
|
`img-src data: https: http: blob:;` +
|
|
574
622
|
`font-src data: https: http:;` +
|
|
@@ -603,13 +651,19 @@ describe("Isomorphic Handler", function () {
|
|
|
603
651
|
const edgeCacheControl = res.header["edge-control"];
|
|
604
652
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
605
653
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
606
|
-
assert.equal(
|
|
607
|
-
|
|
654
|
+
assert.equal(
|
|
655
|
+
cacheControl,
|
|
656
|
+
"public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
657
|
+
);
|
|
658
|
+
assert.equal(
|
|
659
|
+
edgeCacheControl,
|
|
660
|
+
"public,maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
661
|
+
);
|
|
608
662
|
assert.equal(edgeCacheTag, undefined);
|
|
609
663
|
assert.equal(
|
|
610
664
|
contentSecurityPolicy,
|
|
611
665
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
612
|
-
`script-src '
|
|
666
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
613
667
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
614
668
|
`img-src data: https: http: blob:;` +
|
|
615
669
|
`font-src data: https: http:;` +
|
|
@@ -644,13 +698,19 @@ describe("Isomorphic Handler", function () {
|
|
|
644
698
|
const edgeCacheControl = res.header["edge-control"];
|
|
645
699
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
646
700
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
647
|
-
assert.equal(
|
|
648
|
-
|
|
701
|
+
assert.equal(
|
|
702
|
+
cacheControl,
|
|
703
|
+
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
704
|
+
);
|
|
705
|
+
assert.equal(
|
|
706
|
+
edgeCacheControl,
|
|
707
|
+
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
708
|
+
);
|
|
649
709
|
assert.equal(edgeCacheTag, "c/1/abcdefgh");
|
|
650
710
|
assert.equal(
|
|
651
711
|
contentSecurityPolicy,
|
|
652
712
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
653
|
-
`script-src '
|
|
713
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
654
714
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
655
715
|
`img-src data: https: http: blob:;` +
|
|
656
716
|
`font-src data: https: http:;` +
|
|
@@ -685,13 +745,19 @@ describe("Isomorphic Handler", function () {
|
|
|
685
745
|
const edgeCacheControl = res.header["edge-control"];
|
|
686
746
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
687
747
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
688
|
-
assert.equal(
|
|
689
|
-
|
|
748
|
+
assert.equal(
|
|
749
|
+
cacheControl,
|
|
750
|
+
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
751
|
+
);
|
|
752
|
+
assert.equal(
|
|
753
|
+
edgeCacheControl,
|
|
754
|
+
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
755
|
+
);
|
|
690
756
|
assert.equal(edgeCacheTag, "c/1/abcdefgh");
|
|
691
757
|
assert.equal(
|
|
692
758
|
contentSecurityPolicy,
|
|
693
759
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
694
|
-
`script-src '
|
|
760
|
+
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
695
761
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
696
762
|
`img-src data: https: http: blob:;` +
|
|
697
763
|
`font-src data: https: http:;` +
|
|
@@ -746,7 +812,10 @@ describe("Isomorphic Handler", function () {
|
|
|
746
812
|
.expect(200)
|
|
747
813
|
.then((res) => {
|
|
748
814
|
const cacheControl = res.header["cache-control"];
|
|
749
|
-
assert.equal(
|
|
815
|
+
assert.equal(
|
|
816
|
+
cacheControl,
|
|
817
|
+
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
818
|
+
);
|
|
750
819
|
})
|
|
751
820
|
.then(done);
|
|
752
821
|
});
|
|
@@ -848,7 +917,8 @@ describe("Isomorphic Handler", function () {
|
|
|
848
917
|
const app = express();
|
|
849
918
|
mountQuintypeAt(app, "/foo");
|
|
850
919
|
createApp(
|
|
851
|
-
(pageType, params, config, client, { host }) =>
|
|
920
|
+
(pageType, params, config, client, { host }) =>
|
|
921
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
852
922
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
853
923
|
{},
|
|
854
924
|
app
|
|
@@ -860,7 +930,10 @@ describe("Isomorphic Handler", function () {
|
|
|
860
930
|
.expect(200)
|
|
861
931
|
.then((res) => {
|
|
862
932
|
const response = JSON.parse(res.text);
|
|
863
|
-
assert.equal(
|
|
933
|
+
assert.equal(
|
|
934
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
935
|
+
response.content
|
|
936
|
+
);
|
|
864
937
|
assert.equal("foobar", response.store.qt.data.text);
|
|
865
938
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
866
939
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -871,7 +944,8 @@ describe("Isomorphic Handler", function () {
|
|
|
871
944
|
const app = express();
|
|
872
945
|
mountQuintypeAt(app, "/foo");
|
|
873
946
|
createApp(
|
|
874
|
-
(pageType, params, config, client, { host }) =>
|
|
947
|
+
(pageType, params, config, client, { host }) =>
|
|
948
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
875
949
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
876
950
|
{},
|
|
877
951
|
app
|
|
@@ -884,7 +958,8 @@ describe("Isomorphic Handler", function () {
|
|
|
884
958
|
const app = express();
|
|
885
959
|
mountQuintypeAt(app, (hostname) => `/${hostname}`);
|
|
886
960
|
createApp(
|
|
887
|
-
(pageType, params, config, client, { host }) =>
|
|
961
|
+
(pageType, params, config, client, { host }) =>
|
|
962
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
888
963
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
889
964
|
{},
|
|
890
965
|
app
|
|
@@ -896,7 +971,10 @@ describe("Isomorphic Handler", function () {
|
|
|
896
971
|
.expect(200)
|
|
897
972
|
.then((res) => {
|
|
898
973
|
const response = JSON.parse(res.text);
|
|
899
|
-
assert.equal(
|
|
974
|
+
assert.equal(
|
|
975
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
976
|
+
response.content
|
|
977
|
+
);
|
|
900
978
|
assert.equal("foobar", response.store.qt.data.text);
|
|
901
979
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
902
980
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -907,7 +985,8 @@ describe("Isomorphic Handler", function () {
|
|
|
907
985
|
const app = express();
|
|
908
986
|
mountQuintypeAt(app, (hostname) => undefined);
|
|
909
987
|
createApp(
|
|
910
|
-
(pageType, params, config, client, { host }) =>
|
|
988
|
+
(pageType, params, config, client, { host }) =>
|
|
989
|
+
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
911
990
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
912
991
|
{},
|
|
913
992
|
app
|
|
@@ -919,7 +998,10 @@ describe("Isomorphic Handler", function () {
|
|
|
919
998
|
.expect(200)
|
|
920
999
|
.then((res) => {
|
|
921
1000
|
const response = JSON.parse(res.text);
|
|
922
|
-
assert.equal(
|
|
1001
|
+
assert.equal(
|
|
1002
|
+
'<div data-page-type="home-page">foobar</div>',
|
|
1003
|
+
response.content
|
|
1004
|
+
);
|
|
923
1005
|
assert.equal("foobar", response.store.qt.data.text);
|
|
924
1006
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
925
1007
|
assert.equal("home-page", response.store.qt.pageType);
|