@quintype/framework 7.7.6-prerender-query-param.2 → 7.7.8-term-connection-on-config.1

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,21 @@
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.7.7](https://github.com/quintype/quintype-node-framework/compare/v7.7.0...v7.7.7) (2022-07-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * remove prerender query param after the prerender check ([#314](https://github.com/quintype/quintype-node-framework/issues/314)) ([94eac28](https://github.com/quintype/quintype-node-framework/commit/94eac28bfd04483cc665c5ce4d2fc8768c84a31b))
11
+ * remove prerender query param after the prerender check [#314](https://github.com/quintype/quintype-node-framework/issues/314) ([#317](https://github.com/quintype/quintype-node-framework/issues/317)) ([0067d81](https://github.com/quintype/quintype-node-framework/commit/0067d81fe545a726948db14a44768876b41f6ba8))
12
+
13
+ ### [7.7.6](https://github.com/quintype/quintype-node-framework/compare/v7.7.5...v7.7.6) (2022-07-28)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * remove prerender query param after the prerender check [#314](https://github.com/quintype/quintype-node-framework/issues/314) ([#317](https://github.com/quintype/quintype-node-framework/issues/317)) ([0067d81](https://github.com/quintype/quintype-node-framework/commit/0067d81fe545a726948db14a44768876b41f6ba8))
19
+
5
20
  ### [7.7.5](https://github.com/quintype/quintype-node-framework/compare/v7.7.4...v7.7.5) (2022-07-14)
6
21
 
7
22
  ### [7.7.4](https://github.com/quintype/quintype-node-framework/compare/v7.7.3...v7.7.4) (2022-07-13)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.7.6-prerender-query-param.2",
3
+ "version": "7.7.8-term-connection-on-config.1",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "prepublishOnly": "npm test && ./bin-dev-scripts/standard-version-release.sh",
12
- "test": "NODE_ENV=test npx mocha --timeout 5000 --recursive --require ./test/babel",
12
+ "test": "NODE_ENV=test npx mocha --recursive --require ./test/babel",
13
13
  "watch-test": "NODE_ENV=test npx mocha --recursive --watch --require ./test/babel",
14
14
  "coverage": "nyc --all npm test",
15
15
  "coverage-html": "nyc --all --reporter=html npm test",
@@ -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.4.26",
34
+ "@quintype/amp": "^2.4.28",
35
35
  "@quintype/backend": "^2.3.1",
36
36
  "@quintype/components": "^3.0.0",
37
37
  "@quintype/prerender-node": "^3.2.26",
package/server/routes.js CHANGED
@@ -178,7 +178,10 @@ function withConfigPartial(
178
178
  })
179
179
  )
180
180
  )
181
- .catch(logError);
181
+ .catch((e) => {
182
+ logError(e);
183
+ res.status(500).send("An internal error occured for this publisher's config");
184
+ });
182
185
  };
183
186
  };
184
187
  }
@@ -25,6 +25,7 @@ const cdnProviderFunc = () => "akamai";
25
25
 
26
26
  function createApp(loadData, routes, opts = {}, app = express()) {
27
27
  const { redirectToLowercaseSlugs = false } = opts;
28
+ const emptyFunc = () => {};
28
29
  isomorphicRoutes(
29
30
  app,
30
31
  Object.assign(
@@ -33,9 +34,10 @@ function createApp(loadData, routes, opts = {}, app = express()) {
33
34
  assetHash: (file) => (file === "app.js" ? "abcdef" : null),
34
35
  assetPath: (file) => `/assets/${file}`,
35
36
  },
36
- getClient: getClientStub,
37
+ getClient: opts.getClientStub || getClientStub,
37
38
  generateRoutes: () => routes,
38
39
  loadData,
40
+ logError: opts.logError || emptyFunc,
39
41
  pickComponent: opts.pickComponent || pickComponent,
40
42
  renderLayout: (res, { store, title, content }) =>
41
43
  res.send(JSON.stringify({ store: store.getState(), title, content })),
@@ -51,6 +53,33 @@ function createApp(loadData, routes, opts = {}, app = express()) {
51
53
  }
52
54
 
53
55
  describe("Isomorphic Handler", function () {
56
+ it("Renders a 404 when a publisher is not found", function (done) {
57
+ const app = createApp(
58
+ (pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
59
+ [{ pageType: "home-page", path: "/", exact: true }],
60
+ {
61
+ getClientStub: (hostname) => {
62
+ return {
63
+ getHostname: () => "demo.quintype.io",
64
+ getConfig: () => Promise.reject("Pubisher not found"),
65
+ baseUrl: "https://www.foo.com",
66
+ };
67
+ },
68
+ logError: (error) => {
69
+ console.log(error);
70
+ },
71
+ }
72
+ );
73
+
74
+ supertest(app)
75
+ .get("/")
76
+ .expect(500)
77
+ .then((res) => {
78
+ assert.equal("An internal error occured for this publisher's config", res.text);
79
+ })
80
+ .then(done);
81
+ });
82
+
54
83
  it("Renders the page if the route matches", function (done) {
55
84
  const app = createApp(
56
85
  (pageType, params, config, client, { host }) =>