@networkpro/web 1.3.0 → 1.4.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/_redirects ADDED
@@ -0,0 +1 @@
1
+ https://www.netwk.pro/* https://netwk.pro/:splat 301
package/eslint.config.mjs CHANGED
@@ -75,6 +75,17 @@ export default [
75
75
  "jsdoc/check-types": "warn", // Checks if types in JSDoc are defined correctly
76
76
  "jsdoc/require-param": "warn", // Requires @param in JSDoc
77
77
  "jsdoc/require-returns": "warn", // Requires @returns in JSDoc
78
+ "jsdoc/require-jsdoc": [
79
+ "warn",
80
+ {
81
+ publicOnly: true,
82
+ require: {
83
+ FunctionDeclaration: true,
84
+ MethodDefinition: true,
85
+ ClassDeclaration: true,
86
+ },
87
+ },
88
+ ],
78
89
  },
79
90
  },
80
91
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@networkpro/web",
3
3
  "private": false,
4
4
  "sideEffects": false,
5
- "version": "1.3.0",
5
+ "version": "1.4.2",
6
6
  "description": "Locking Down Networks, Unlocking Confidence | Security, Networking, Privacy — Network Pro Strategies",
7
7
  "keywords": [
8
8
  "security",
@@ -30,41 +30,61 @@
30
30
  },
31
31
  "type": "module",
32
32
  "engines": {
33
- "node": ">=22"
33
+ "node": ">=22.0.0 <25",
34
+ "npm": ">=11.0.0 <12"
34
35
  },
35
- "main": "src/app.html",
36
36
  "style": "src/lib/styles/global.min.css",
37
- "scripts": {
38
- "upgrade": "npx npm-check-updates -u",
39
- "dev": "vite dev",
40
- "build": "vite build",
41
- "build:netlify": "netlify build",
42
- "preview": "vite preview",
43
- "prepare": "svelte-kit sync || echo ''",
44
- "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
45
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
46
- "clean": "rm -rf build/* node_modules package-lock.json && npm install",
47
- "format": "prettier --check .",
48
- "format:fix": "prettier --write .",
49
- "lint": "eslint --ext .mjs,.js,.svelte --config eslint.config.mjs .",
50
- "lint:fix": "eslint --ext .mjs,.js,.svelte --config eslint.config.mjs . --fix",
51
- "lint:md": "npx markdownlint-cli2 \"**/*.{md,markdown}\" \"#node_modules/**\" \"#build/**\"",
52
- "lint:css": "stylelint \"**/*.{css,svelte}\" --ignore-path .stylelintignore",
53
- "lint:all": "npm run lint && npm run lint:md && npm run lint:css && npm run format",
54
- "lhci": "lhci",
55
- "lighthouse": "npm run lighthouse:local",
56
- "lighthouse:local": "npm run build && npm run preview & wait-on http://localhost:4173 && npm run lhci:run",
57
- "lhci:run": "lhci autorun --config=.lighthouserc.cjs",
58
- "test": "npm run test:all",
59
- "test:all": "npm run test:client -- --run && npm run test:server -- --run",
60
- "test:client": "vitest --config vitest.config.client.js",
61
- "test:server": "vitest --config vitest.config.server.js",
62
- "test:watch": "vitest --config vitest.config.client.js --watch",
63
- "test:coverage": "npm run test:client -- --run --coverage && npm run test:server -- --run --coverage",
64
- "css:bundle": "node scripts/bundleCss.js",
65
- "head:flatten": "node scripts/flattenHeaders.js",
66
- "head:validate": "node scripts/validateHeaders.js",
67
- "checkout": "npm run test:all && npm run lint:all && npm run check"
37
+ "scripts": {
38
+ "dev": "vite dev",
39
+ "preview": "vite preview",
40
+ "start": "npm run dev",
41
+
42
+ "build": "vite build",
43
+ "build:netlify": "netlify build",
44
+ "css:bundle": "node scripts/bundleCss.js",
45
+
46
+ "prepare": "svelte-kit sync || echo ''",
47
+ "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
48
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
49
+ "check:env": "node scripts/checkEnv.js",
50
+ "check:node": "node scripts/checkNode.js",
51
+
52
+ "checkout": "npm run check:node && npm run test:all && npm run lint:all && npm run check && npm run audit:scripts",
53
+ "verify": "npm run checkout",
54
+
55
+ "delete": "rm -rf build .svelte-kit node_modules package-lock.json",
56
+ "clean": "npm run delete && npm cache clean --force && npm install",
57
+ "upgrade": "npx npm-check-updates -u",
58
+
59
+ "test": "npm run test:all",
60
+ "test:all": "npm run test:client -- --run && npm run test:server -- --run",
61
+ "test:client": "vitest --config vitest.config.client.js",
62
+ "test:server": "vitest --config vitest.config.server.js",
63
+ "test:watch": "vitest --config vitest.config.client.js --watch",
64
+ "test:coverage": "npm run test:client -- --run --coverage && npm run test:server -- --run --coverage",
65
+
66
+ "lint": "eslint . --ext .mjs,.js,.svelte",
67
+ "lint:fix": "eslint . --ext .mjs,.js,.svelte --fix",
68
+ "lint:jsdoc": "eslint . --ext .js,.mjs,.svelte --max-warnings=0",
69
+ "lint:css": "stylelint \"**/*.{css,svelte}\" --ignore-path .stylelintignore",
70
+ "lint:md": "npx markdownlint-cli2 \"**/*.{md,markdown}\" \"#node_modules/**\" \"#build/**\"",
71
+ "lint:all": "npm run lint && npm run lint:md && npm run lint:css && npm run format",
72
+ "format": "prettier --check .",
73
+ "format:fix": "prettier --write .",
74
+
75
+ "lhci": "lhci",
76
+ "lighthouse": "npm run lighthouse:local",
77
+ "lighthouse:local": "npm run build && npm run preview & wait-on http://localhost:4173 && npm run lhci:run",
78
+ "lhci:run": "lhci autorun --config=.lighthouserc.cjs",
79
+
80
+ "audit:scripts": "node scripts/auditScripts.js",
81
+ "head:flatten": "node scripts/flattenHeaders.js",
82
+ "head:validate": "node scripts/validateHeaders.js",
83
+
84
+ "postinstall": "npm run check:node"
85
+ },
86
+ "dependencies": {
87
+ "svelte": "5.31.1"
68
88
  },
69
89
  "devDependencies": {
70
90
  "@eslint/compat": "^1.2.9",
@@ -72,21 +92,20 @@
72
92
  "@netlify/plugin-sitemap": "^0.8.1",
73
93
  "@playwright/test": "^1.52.0",
74
94
  "@sveltejs/adapter-netlify": "^5.0.2",
75
- "@sveltejs/kit": "^2.21.1",
76
- "@sveltejs/vite-plugin-svelte": "^5.0.3",
95
+ "@sveltejs/kit": "2.21.1",
96
+ "@sveltejs/vite-plugin-svelte": "5.0.3",
77
97
  "@testing-library/jest-dom": "^6.6.3",
78
- "@testing-library/svelte": "^5.2.7",
79
- "@vitest/coverage-v8": "^3.1.3",
98
+ "@testing-library/svelte": "^5.2.8",
99
+ "@vitest/coverage-v8": "^3.1.4",
80
100
  "autoprefixer": "^10.4.21",
81
101
  "browserslist": "^4.24.5",
82
102
  "eslint": "^9.27.0",
83
103
  "eslint-config-prettier": "^10.1.5",
84
104
  "eslint-plugin-jsdoc": "^50.6.17",
85
- "eslint-plugin-svelte": "^3.8.1",
105
+ "eslint-plugin-svelte": "^3.8.2",
86
106
  "globals": "^16.1.0",
87
107
  "jsdom": "^26.1.0",
88
108
  "lightningcss": "^1.30.1",
89
- "lightningcss-cli": "^1.30.1",
90
109
  "markdownlint": "^0.38.0",
91
110
  "markdownlint-cli2": "^0.18.1",
92
111
  "mdsvex": "^0.12.6",
@@ -95,18 +114,18 @@
95
114
  "postcss-html": "^1.8.0",
96
115
  "prettier": "^3.5.3",
97
116
  "prettier-plugin-svelte": "^3.4.0",
117
+ "semver": "^7.7.2",
98
118
  "stylelint": "^16.19.1",
99
119
  "stylelint-config-html": "^1.1.0",
100
120
  "stylelint-config-recommended": "^16.0.0",
101
121
  "stylelint-order": "^7.0.0",
102
- "svelte": "^5.30.2",
103
122
  "svelte-check": "^4.2.1",
104
123
  "svelte-eslint-parser": "^1.2.0",
105
124
  "svelte-preprocess": "^6.0.3",
106
125
  "typescript": "^5.8.3",
107
126
  "vite": "^6.3.5",
108
127
  "vite-plugin-lightningcss": "^0.0.5",
109
- "vitest": "^3.1.3"
128
+ "vitest": "^3.1.4"
110
129
  },
111
130
  "overrides": {
112
131
  "@sveltejs/kit": {
@@ -12,7 +12,8 @@ import { defineConfig, devices } from "@playwright/test";
12
12
  * @see https://playwright.dev/docs/test-configuration
13
13
  */
14
14
  export default defineConfig({
15
- testDir: "./tests",
15
+ testDir: "./tests/e2e",
16
+ testMatch: "*.spec.js",
16
17
 
17
18
  /* Run tests in files in parallel */
18
19
  fullyParallel: true,
@@ -0,0 +1,94 @@
1
+ /* ==========================================================================
2
+ scripts/auditScripts.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Audit for untested script modules in scripts/
10
+ * Looks for any .js/.mjs files without a matching test in tests/
11
+ *
12
+ * @module scripts/
13
+ * @author SunDevil311
14
+ * @updated 2025-05-21
15
+ */
16
+
17
+ import fs from "fs";
18
+ import path from "path";
19
+
20
+ const scriptsDir = path.resolve("./scripts");
21
+ const testsDir = path.resolve("./tests");
22
+
23
+ // Scripts intentionally excluded from test coverage
24
+ const allowList = new Set([
25
+ "checkNode.js",
26
+ "auditScripts.js", // itself
27
+ ]);
28
+
29
+ // Recursively gather all test files
30
+ function getAllTestFiles(dir) {
31
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
32
+ const files = [];
33
+
34
+ for (const entry of entries) {
35
+ const fullPath = path.join(dir, entry.name);
36
+ if (entry.isDirectory()) {
37
+ files.push(...getAllTestFiles(fullPath));
38
+ } else if (
39
+ entry.isFile() &&
40
+ (entry.name.endsWith(".test.js") ||
41
+ entry.name.endsWith(".spec.js") ||
42
+ entry.name.endsWith(".test.mjs") ||
43
+ entry.name.endsWith(".spec.mjs"))
44
+ ) {
45
+ files.push(fullPath);
46
+ }
47
+ }
48
+
49
+ return files;
50
+ }
51
+
52
+ // Get base names of tested modules (no extension or test specifier)
53
+ const testFiles = getAllTestFiles(testsDir);
54
+ const testedModules = new Set(
55
+ testFiles.map((filePath) =>
56
+ path
57
+ .basename(filePath)
58
+ .replace(/\.test\.js$|\.spec\.js$|\.test\.mjs$|\.spec\.mjs$/, ""),
59
+ ),
60
+ );
61
+
62
+ // Gather all scripts (.js and .mjs)
63
+ const scriptFiles = fs
64
+ .readdirSync(scriptsDir)
65
+ .filter((file) => file.endsWith(".js") || file.endsWith(".mjs"));
66
+
67
+ const untested = scriptFiles.filter((file) => {
68
+ const base = file.replace(/\.(js|mjs)$/, "");
69
+ return !allowList.has(file) && !testedModules.has(base);
70
+ });
71
+
72
+ const pathRelative = (file) =>
73
+ path.relative(process.cwd(), path.join(scriptsDir, file));
74
+
75
+ // Output results
76
+ if (untested.length) {
77
+ console.warn("\n⚠ Untested script files detected:\n");
78
+
79
+ untested.forEach((file) => {
80
+ const filePath = pathRelative(file);
81
+ console.warn(
82
+ `::warning file=${filePath},line=1,col=1::Missing test file for ${file}`,
83
+ );
84
+ });
85
+
86
+ console.warn(
87
+ `\nAdd a corresponding test file in /tests (e.g., ${untested[0].replace(
88
+ /\.(js|mjs)$/,
89
+ ".test.js",
90
+ )})`,
91
+ );
92
+ } else {
93
+ console.log("✅ All script files have corresponding tests.");
94
+ }
@@ -0,0 +1,66 @@
1
+ /* ==========================================================================
2
+ scripts/checkEnv.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Utility to validate execution environment
10
+ * Ensures `ENV_MODE` is defined and matches allowed environments
11
+ *
12
+ * @module scripts/
13
+ * @author SunDevil311
14
+ * @updated 2025-05-21
15
+ */
16
+
17
+ import { basename } from "path";
18
+ import { fileURLToPath } from "url";
19
+
20
+ const validEnvs = new Set(["dev", "test", "ci", "prod", "preview"]);
21
+
22
+ /**
23
+ * Checks and returns validation for ENV_MODE
24
+ * @returns {{
25
+ * mode: string,
26
+ * valid: boolean,
27
+ * wasDefaulted: boolean,
28
+ * allowed: string[]
29
+ * }}
30
+ */
31
+ export function checkEnv() {
32
+ const current = process.env.ENV_MODE;
33
+ let mode = current;
34
+ let valid = false;
35
+ let wasDefaulted = false;
36
+
37
+ if (!mode) {
38
+ mode = "dev";
39
+ process.env.ENV_MODE = mode;
40
+ wasDefaulted = true;
41
+ console.warn("⚠️ ENV_MODE not set. Defaulting to 'dev'.");
42
+ }
43
+
44
+ valid = validEnvs.has(mode);
45
+
46
+ if (valid) {
47
+ const tag = wasDefaulted ? "[info]" : "[ok]";
48
+ console.log(`${tag} ENV_MODE is set to: "${mode}"`);
49
+ } else {
50
+ console.error(
51
+ `❌ Invalid ENV_MODE "${mode}". Must be one of: ${[...validEnvs].join(", ")}`,
52
+ );
53
+ }
54
+
55
+ return {
56
+ mode,
57
+ valid,
58
+ wasDefaulted,
59
+ allowed: [...validEnvs].sort(),
60
+ };
61
+ }
62
+
63
+ // ✅ Run only if called directly via CLI
64
+ if (basename(fileURLToPath(import.meta.url)) === basename(process.argv[1])) {
65
+ checkEnv();
66
+ }
@@ -0,0 +1,54 @@
1
+ /* ==========================================================================
2
+ scripts/checkNode.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Utility to check Node.js and NPM version
10
+ * Ensures the current environment matches the required versions from package.json
11
+ *
12
+ * @module scripts/
13
+ * @author SunDevil311
14
+ * @updated 2025-05-20
15
+ */
16
+
17
+ import { execSync } from "child_process";
18
+ import fs from "fs";
19
+ import path from "path";
20
+ import semver from "semver";
21
+
22
+ // Load engines from package.json
23
+ const pkg = JSON.parse(fs.readFileSync(path.resolve("./package.json"), "utf8"));
24
+ const { node: nodeRange, npm: npmRange } = pkg.engines;
25
+
26
+ // Check Node version
27
+ if (!semver.satisfies(process.version, nodeRange)) {
28
+ console.error(
29
+ `⚠️ Node version ${process.version} does not match required range: ${nodeRange}`,
30
+ );
31
+ process.exit(1);
32
+ }
33
+
34
+ // Check NPM version
35
+ let npmVersion;
36
+
37
+ try {
38
+ npmVersion = execSync("npm --version").toString().trim();
39
+ if (!semver.satisfies(npmVersion, npmRange)) {
40
+ console.error(
41
+ `⚠️ NPM version ${npmVersion} does not match required range: ${npmRange}`,
42
+ );
43
+ process.exit(1);
44
+ }
45
+ } catch (err) {
46
+ console.error("❌ Failed to check NPM version:", err.message);
47
+ process.exit(1);
48
+ }
49
+
50
+ if (!process.env.CI || process.env.VERBOSE === "true") {
51
+ console.log(
52
+ `✅ Node (${process.version}) matches ${nodeRange}, and NPM (${npmVersion}) matches ${npmRange}`,
53
+ );
54
+ }
@@ -0,0 +1,58 @@
1
+ /* ==========================================================================
2
+ scripts/checkVersions.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Utility to check Node.js and NPM version (non-blocking)
10
+ * Returns version info, can be unit tested, and doesn't kill process during
11
+ * test runs
12
+ *
13
+ * @module scripts/
14
+ * @author SunDevil311
15
+ * @updated 2025-05-20
16
+ */
17
+
18
+ import { execSync } from "child_process";
19
+ import fs from "fs";
20
+ import path from "path";
21
+ import semver from "semver";
22
+
23
+ /**
24
+ * @typedef {object} VersionCheckResult
25
+ * @property {string} nodeVersion
26
+ * @property {string} npmVersion
27
+ * @property {string} nodeRange
28
+ * @property {string} npmRange
29
+ * @property {boolean} nodeValid
30
+ * @property {boolean} npmValid
31
+ */
32
+
33
+ /**
34
+ * Returns an object with validation results for Node and NPM versions.
35
+ *
36
+ * @returns {VersionCheckResult}
37
+ */
38
+ export function checkVersions() {
39
+ const pkg = JSON.parse(
40
+ fs.readFileSync(path.resolve("./package.json"), "utf8"),
41
+ );
42
+ const { node: nodeRange, npm: npmRange } = pkg.engines;
43
+
44
+ const nodeVersion = process.version;
45
+ const npmVersion = execSync("npm --version").toString().trim();
46
+
47
+ const nodeValid = semver.satisfies(nodeVersion, nodeRange);
48
+ const npmValid = semver.satisfies(npmVersion, npmRange);
49
+
50
+ return {
51
+ nodeVersion,
52
+ npmVersion,
53
+ nodeRange,
54
+ npmRange,
55
+ nodeValid,
56
+ npmValid,
57
+ };
58
+ }
@@ -6,6 +6,8 @@ This file is part of Network Pro.
6
6
  ========================================================================== -->
7
7
 
8
8
  <script>
9
+ /* eslint-disable svelte/no-at-html-tags */
10
+
9
11
  import FossFeatures from "$lib/components/foss/FossFeatures.svelte";
10
12
  // Import directly from $lib by way of image utility
11
13
  import { obtainiumPng, obtainiumWbp } from "$lib";
@@ -85,14 +87,17 @@ This file is part of Network Pro.
85
87
 
86
88
  <h3>{fossItem.headline}</h3>
87
89
 
88
- {@html fossItem.headlineDescription}
90
+ <!-- Trusted input, from internal CMS -->
91
+ {@html fossItem.detailsDescription}
89
92
 
90
93
  <FossFeatures features={fossItem.features} />
91
94
 
95
+ <!-- Trusted input, from internal CMS -->
92
96
  {@html fossItem.detailsDescription}
93
97
 
94
98
  {#each fossItem.notes as note}
95
99
  <blockquote class="bquote">
100
+ <!-- Trusted input, from internal CMS -->
96
101
  {@html note}
97
102
  </blockquote>
98
103
  {/each}
package/static/robots.txt CHANGED
@@ -6,7 +6,22 @@
6
6
  # www.robotstxt.org/
7
7
 
8
8
  User-agent: *
9
- Disallow: *.jsonc$
10
- Disallow: *.json$
11
- Disallow: *.mjs$
12
- Disallow: *.js$
9
+
10
+ # Disallow dev and CI/CD artifacts
11
+ Disallow: /tests/
12
+ Disallow: /scripts/
13
+ Disallow: /playwright-report/
14
+ Disallow: /reports/
15
+ Disallow: /coverage/
16
+ Disallow: /build/
17
+ Disallow: /.lighthouseci/
18
+
19
+ # Disallow stub routes that redirect externally
20
+ Disallow: /contact
21
+ Disallow: /privacy-rights
22
+
23
+ # Allow everything else
24
+ Allow: /
25
+
26
+ # Inform bots where to find the sitemap
27
+ Sitemap: https://netwk.pro/sitemap.xml
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================================
2
- src/app.spec.js
2
+ tests/e2e/app.spec.js
3
3
 
4
4
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
5
  This file is part of Network Pro.
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================================
2
- src/mobile.spec.js
2
+ tests/e2e/mobile.spec.js
3
3
 
4
4
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
5
  This file is part of Network Pro.
@@ -0,0 +1,42 @@
1
+ /* ==========================================================================
2
+ tests/unit/auditScripts.test.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Unit test for scripts/auditScripts.js
10
+ */
11
+
12
+ import fs from "fs";
13
+ import path from "path";
14
+ import { describe, expect, it } from "vitest";
15
+
16
+ describe("auditScripts.js", () => {
17
+ it("should identify untested scripts correctly", () => {
18
+ const scriptsDir = path.resolve("./scripts");
19
+ const testsDir = path.resolve("./tests");
20
+
21
+ const allowList = new Set(["checkNode.js", "auditScripts.js"]);
22
+
23
+ const scriptFiles = fs
24
+ .readdirSync(scriptsDir)
25
+ .filter((file) => file.endsWith(".js"));
26
+
27
+ const testFiles = fs
28
+ .readdirSync(testsDir)
29
+ .filter((file) => file.endsWith(".test.js") || file.endsWith(".spec.js"));
30
+
31
+ const testedModules = new Set(
32
+ testFiles.map((f) => f.replace(/\.test\.js$|\.spec\.js$/, "")),
33
+ );
34
+
35
+ const untested = scriptFiles.filter((file) => {
36
+ const base = file.replace(/\.js$/, "");
37
+ return !allowList.has(file) && !testedModules.has(base);
38
+ });
39
+
40
+ expect(untested).not.toContain("auditScripts.js");
41
+ });
42
+ });
@@ -0,0 +1,48 @@
1
+ /* ==========================================================================
2
+ tests/unit/checkEnv.test.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Unit test for scripts/checkEnv.js
10
+ */
11
+
12
+ import { afterEach, describe, expect, it } from "vitest";
13
+ import { checkEnv } from "../../scripts/checkEnv.js";
14
+
15
+ describe("checkEnv()", () => {
16
+ const originalEnv = process.env.ENV_MODE;
17
+
18
+ afterEach(() => {
19
+ if (originalEnv === undefined) {
20
+ delete process.env.ENV_MODE;
21
+ } else {
22
+ process.env.ENV_MODE = originalEnv;
23
+ }
24
+ });
25
+
26
+ it("should default to 'dev' if ENV_MODE is not set", () => {
27
+ delete process.env.ENV_MODE;
28
+ const result = checkEnv();
29
+ expect(result.mode).toBe("dev");
30
+ expect(result.valid).toBe(true);
31
+ expect(result.wasDefaulted).toBe(true);
32
+ });
33
+
34
+ it("should validate a correct ENV_MODE", () => {
35
+ process.env.ENV_MODE = "ci";
36
+ const result = checkEnv();
37
+ expect(result.mode).toBe("ci");
38
+ expect(result.valid).toBe(true);
39
+ expect(result.wasDefaulted).toBe(false);
40
+ });
41
+
42
+ it("should return invalid for an unknown ENV_MODE", () => {
43
+ process.env.ENV_MODE = "banana";
44
+ const result = checkEnv();
45
+ expect(result.valid).toBe(false);
46
+ expect(result.allowed).toContain("dev");
47
+ });
48
+ });
@@ -0,0 +1,24 @@
1
+ /* ==========================================================================
2
+ tests/unit/checkVersions.test.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================== */
7
+
8
+ /**
9
+ * Unit test for scripts/checkVersions.js
10
+ */
11
+
12
+ import { describe, expect, it } from "vitest";
13
+ import { checkVersions } from "../../scripts/checkVersions.js";
14
+
15
+ describe("checkVersions()", () => {
16
+ it("should match current Node and NPM versions to engine ranges", () => {
17
+ const result = checkVersions();
18
+
19
+ expect(result.nodeVersion).toMatch(/^v\d+\.\d+\.\d+$/);
20
+ expect(result.npmVersion).toMatch(/^\d+\.\d+\.\d+$/);
21
+ expect(result.nodeValid).toBe(true);
22
+ expect(result.npmValid).toBe(true);
23
+ });
24
+ });
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================================
2
- src/demo.spec.js
2
+ tests/unit/demo.spec.js
3
3
 
4
4
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
5
  This file is part of Network Pro.
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================================
2
- src/routes/page.svelte.test.js
2
+ tests/unit/routes/page.svelte.test.js
3
3
 
4
4
  SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
5
  This file is part of Network Pro.
@@ -8,7 +8,7 @@ This file is part of Network Pro.
8
8
  import "@testing-library/jest-dom/vitest";
9
9
  import { render, screen } from "@testing-library/svelte";
10
10
  import { describe, expect, test } from "vitest";
11
- import Page from "./+page.svelte";
11
+ import Page from "../../../src/routes/+page.svelte";
12
12
 
13
13
  describe("/+page.svelte", () => {
14
14
  test("should render the home page section", () => {
package/vite.config.js CHANGED
@@ -1,3 +1,10 @@
1
+ /* =========================================================================
2
+ vite.config.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================= */
7
+
1
8
  import { sveltekit } from "@sveltejs/kit/vite";
2
9
  import { defineConfig } from "vite";
3
10
  import lightningcssPlugin from "vite-plugin-lightningcss";
@@ -1,3 +1,10 @@
1
+ /* =========================================================================
2
+ vitest.config.client.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================= */
7
+
1
8
  import { sveltekit } from "@sveltejs/kit/vite";
2
9
  import { svelteTesting } from "@testing-library/svelte/vite";
3
10
  import lightningcssPlugin from "vite-plugin-lightningcss";
@@ -18,8 +25,8 @@ export default defineConfig({
18
25
  name: "client",
19
26
  environment: "jsdom",
20
27
  clearMocks: true,
21
- include: ["src/**/*.svelte.{test,spec}.{js,mjs}"],
22
- exclude: ["src/lib/server/**"],
28
+ include: ["tests/unit/**/*.svelte.test.{js,mjs}"],
29
+ exclude: [],
23
30
  setupFiles: ["./vitest-setup-client.js"],
24
31
  reporters: ["default", "json"],
25
32
  outputFile: {
@@ -1,3 +1,10 @@
1
+ /* =========================================================================
2
+ vitest.config.server.js
3
+
4
+ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
+ This file is part of Network Pro.
6
+ ========================================================================= */
7
+
1
8
  import { sveltekit } from "@sveltejs/kit/vite";
2
9
  import lightningcssPlugin from "vite-plugin-lightningcss";
3
10
  import { defineConfig } from "vitest/config";
@@ -15,8 +22,8 @@ export default defineConfig({
15
22
  test: {
16
23
  name: "server",
17
24
  environment: "node",
18
- include: ["src/**/*.{test,spec}.{js,mjs}"],
19
- exclude: ["src/**/*.svelte.{test,spec}.{js,mjs}"],
25
+ include: ["tests/unit/**/*.test.{js,mjs}"],
26
+ exclude: ["tests/unit/**/*.svelte.test.{js,mjs}"],
20
27
  reporters: ["default", "json"],
21
28
  outputFile: {
22
29
  json: "./reports/server/results.json",
@@ -1,504 +0,0 @@
1
- /* ==========================================================================
2
- src/tests-examples/demo-todo-app.spec.js
3
-
4
- SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
5
- This file is part of Network Pro.
6
- ========================================================================== */
7
-
8
- // @ts-check
9
- import { expect, test } from "@playwright/test";
10
-
11
- test.beforeEach(async ({ page }) => {
12
- await page.goto("https://demo.playwright.dev/todomvc");
13
- });
14
-
15
- const TODO_ITEMS = [
16
- "buy some cheese",
17
- "feed the cat",
18
- "book a doctors appointment",
19
- ];
20
-
21
- test.describe("New Todo", () => {
22
- test("should allow me to add todo items", async ({ page }) => {
23
- // create a new todo locator
24
- const newTodo = page.getByPlaceholder("What needs to be done?");
25
-
26
- // Create 1st todo.
27
- await newTodo.fill(TODO_ITEMS[0]);
28
- await newTodo.press("Enter");
29
-
30
- // Make sure the list only has one todo item.
31
- await expect(page.getByTestId("todo-title")).toHaveText([TODO_ITEMS[0]]);
32
-
33
- // Create 2nd todo.
34
- await newTodo.fill(TODO_ITEMS[1]);
35
- await newTodo.press("Enter");
36
-
37
- // Make sure the list now has two todo items.
38
- await expect(page.getByTestId("todo-title")).toHaveText([
39
- TODO_ITEMS[0],
40
- TODO_ITEMS[1],
41
- ]);
42
-
43
- await checkNumberOfTodosInLocalStorage(page, 2);
44
- });
45
-
46
- test("should clear text input field when an item is added", async ({
47
- page,
48
- }) => {
49
- // create a new todo locator
50
- const newTodo = page.getByPlaceholder("What needs to be done?");
51
-
52
- // Create one todo item.
53
- await newTodo.fill(TODO_ITEMS[0]);
54
- await newTodo.press("Enter");
55
-
56
- // Check that input is empty.
57
- await expect(newTodo).toBeEmpty();
58
- await checkNumberOfTodosInLocalStorage(page, 1);
59
- });
60
-
61
- test("should append new items to the bottom of the list", async ({
62
- page,
63
- }) => {
64
- // Create 3 items.
65
- await createDefaultTodos(page);
66
-
67
- // create a todo count locator
68
- const todoCount = page.getByTestId("todo-count");
69
-
70
- // Check test using different methods.
71
- await expect(page.getByText("3 items left")).toBeVisible();
72
- await expect(todoCount).toHaveText("3 items left");
73
- await expect(todoCount).toContainText("3");
74
- await expect(todoCount).toHaveText(/3/);
75
-
76
- // Check all items in one call.
77
- await expect(page.getByTestId("todo-title")).toHaveText(TODO_ITEMS);
78
- await checkNumberOfTodosInLocalStorage(page, 3);
79
- });
80
- });
81
-
82
- test.describe("Mark all as completed", () => {
83
- test.beforeEach(async ({ page }) => {
84
- await createDefaultTodos(page);
85
- await checkNumberOfTodosInLocalStorage(page, 3);
86
- });
87
-
88
- test.afterEach(async ({ page }) => {
89
- await checkNumberOfTodosInLocalStorage(page, 3);
90
- });
91
-
92
- test("should allow me to mark all items as completed", async ({ page }) => {
93
- // Complete all todos.
94
- await page.getByLabel("Mark all as complete").check();
95
-
96
- // Ensure all todos have 'completed' class.
97
- await expect(page.getByTestId("todo-item")).toHaveClass([
98
- "completed",
99
- "completed",
100
- "completed",
101
- ]);
102
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
103
- });
104
-
105
- test("should allow me to clear the complete state of all items", async ({
106
- page,
107
- }) => {
108
- const toggleAll = page.getByLabel("Mark all as complete");
109
- // Check and then immediately uncheck.
110
- await toggleAll.check();
111
- await toggleAll.uncheck();
112
-
113
- // Should be no completed classes.
114
- await expect(page.getByTestId("todo-item")).toHaveClass(["", "", ""]);
115
- });
116
-
117
- test("complete all checkbox should update state when items are completed / cleared", async ({
118
- page,
119
- }) => {
120
- const toggleAll = page.getByLabel("Mark all as complete");
121
- await toggleAll.check();
122
- await expect(toggleAll).toBeChecked();
123
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
124
-
125
- // Uncheck first todo.
126
- const firstTodo = page.getByTestId("todo-item").nth(0);
127
- await firstTodo.getByRole("checkbox").uncheck();
128
-
129
- // Reuse toggleAll locator and make sure its not checked.
130
- await expect(toggleAll).not.toBeChecked();
131
-
132
- await firstTodo.getByRole("checkbox").check();
133
- await checkNumberOfCompletedTodosInLocalStorage(page, 3);
134
-
135
- // Assert the toggle all is checked again.
136
- await expect(toggleAll).toBeChecked();
137
- });
138
- });
139
-
140
- test.describe("Item", () => {
141
- test("should allow me to mark items as complete", async ({ page }) => {
142
- // create a new todo locator
143
- const newTodo = page.getByPlaceholder("What needs to be done?");
144
-
145
- // Create two items.
146
- for (const item of TODO_ITEMS.slice(0, 2)) {
147
- await newTodo.fill(item);
148
- await newTodo.press("Enter");
149
- }
150
-
151
- // Check first item.
152
- const firstTodo = page.getByTestId("todo-item").nth(0);
153
- await firstTodo.getByRole("checkbox").check();
154
- await expect(firstTodo).toHaveClass("completed");
155
-
156
- // Check second item.
157
- const secondTodo = page.getByTestId("todo-item").nth(1);
158
- await expect(secondTodo).not.toHaveClass("completed");
159
- await secondTodo.getByRole("checkbox").check();
160
-
161
- // Assert completed class.
162
- await expect(firstTodo).toHaveClass("completed");
163
- await expect(secondTodo).toHaveClass("completed");
164
- });
165
-
166
- test("should allow me to un-mark items as complete", async ({ page }) => {
167
- // create a new todo locator
168
- const newTodo = page.getByPlaceholder("What needs to be done?");
169
-
170
- // Create two items.
171
- for (const item of TODO_ITEMS.slice(0, 2)) {
172
- await newTodo.fill(item);
173
- await newTodo.press("Enter");
174
- }
175
-
176
- const firstTodo = page.getByTestId("todo-item").nth(0);
177
- const secondTodo = page.getByTestId("todo-item").nth(1);
178
- const firstTodoCheckbox = firstTodo.getByRole("checkbox");
179
-
180
- await firstTodoCheckbox.check();
181
- await expect(firstTodo).toHaveClass("completed");
182
- await expect(secondTodo).not.toHaveClass("completed");
183
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
184
-
185
- await firstTodoCheckbox.uncheck();
186
- await expect(firstTodo).not.toHaveClass("completed");
187
- await expect(secondTodo).not.toHaveClass("completed");
188
- await checkNumberOfCompletedTodosInLocalStorage(page, 0);
189
- });
190
-
191
- test("should allow me to edit an item", async ({ page }) => {
192
- await createDefaultTodos(page);
193
-
194
- const todoItems = page.getByTestId("todo-item");
195
- const secondTodo = todoItems.nth(1);
196
- await secondTodo.dblclick();
197
- await expect(secondTodo.getByRole("textbox", { name: "Edit" })).toHaveValue(
198
- TODO_ITEMS[1],
199
- );
200
- await secondTodo
201
- .getByRole("textbox", { name: "Edit" })
202
- .fill("buy some sausages");
203
- await secondTodo.getByRole("textbox", { name: "Edit" }).press("Enter");
204
-
205
- // Explicitly assert the new text value.
206
- await expect(todoItems).toHaveText([
207
- TODO_ITEMS[0],
208
- "buy some sausages",
209
- TODO_ITEMS[2],
210
- ]);
211
- await checkTodosInLocalStorage(page, "buy some sausages");
212
- });
213
- });
214
-
215
- test.describe("Editing", () => {
216
- test.beforeEach(async ({ page }) => {
217
- await createDefaultTodos(page);
218
- await checkNumberOfTodosInLocalStorage(page, 3);
219
- });
220
-
221
- test("should hide other controls when editing", async ({ page }) => {
222
- const todoItem = page.getByTestId("todo-item").nth(1);
223
- await todoItem.dblclick();
224
- await expect(todoItem.getByRole("checkbox")).not.toBeVisible();
225
- await expect(
226
- todoItem.locator("label", {
227
- hasText: TODO_ITEMS[1],
228
- }),
229
- ).not.toBeVisible();
230
- await checkNumberOfTodosInLocalStorage(page, 3);
231
- });
232
-
233
- test("should save edits on blur", async ({ page }) => {
234
- const todoItems = page.getByTestId("todo-item");
235
- await todoItems.nth(1).dblclick();
236
- await todoItems
237
- .nth(1)
238
- .getByRole("textbox", { name: "Edit" })
239
- .fill("buy some sausages");
240
- await todoItems
241
- .nth(1)
242
- .getByRole("textbox", { name: "Edit" })
243
- .dispatchEvent("blur");
244
-
245
- await expect(todoItems).toHaveText([
246
- TODO_ITEMS[0],
247
- "buy some sausages",
248
- TODO_ITEMS[2],
249
- ]);
250
- await checkTodosInLocalStorage(page, "buy some sausages");
251
- });
252
-
253
- test("should trim entered text", async ({ page }) => {
254
- const todoItems = page.getByTestId("todo-item");
255
- await todoItems.nth(1).dblclick();
256
- await todoItems
257
- .nth(1)
258
- .getByRole("textbox", { name: "Edit" })
259
- .fill(" buy some sausages ");
260
- await todoItems
261
- .nth(1)
262
- .getByRole("textbox", { name: "Edit" })
263
- .press("Enter");
264
-
265
- await expect(todoItems).toHaveText([
266
- TODO_ITEMS[0],
267
- "buy some sausages",
268
- TODO_ITEMS[2],
269
- ]);
270
- await checkTodosInLocalStorage(page, "buy some sausages");
271
- });
272
-
273
- test("should remove the item if an empty text string was entered", async ({
274
- page,
275
- }) => {
276
- const todoItems = page.getByTestId("todo-item");
277
- await todoItems.nth(1).dblclick();
278
- await todoItems.nth(1).getByRole("textbox", { name: "Edit" }).fill("");
279
- await todoItems
280
- .nth(1)
281
- .getByRole("textbox", { name: "Edit" })
282
- .press("Enter");
283
-
284
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
285
- });
286
-
287
- test("should cancel edits on escape", async ({ page }) => {
288
- const todoItems = page.getByTestId("todo-item");
289
- await todoItems.nth(1).dblclick();
290
- await todoItems
291
- .nth(1)
292
- .getByRole("textbox", { name: "Edit" })
293
- .fill("buy some sausages");
294
- await todoItems
295
- .nth(1)
296
- .getByRole("textbox", { name: "Edit" })
297
- .press("Escape");
298
- await expect(todoItems).toHaveText(TODO_ITEMS);
299
- });
300
- });
301
-
302
- test.describe("Counter", () => {
303
- test("should display the current number of todo items", async ({ page }) => {
304
- // create a new todo locator
305
- const newTodo = page.getByPlaceholder("What needs to be done?");
306
-
307
- // create a todo count locator
308
- const todoCount = page.getByTestId("todo-count");
309
-
310
- await newTodo.fill(TODO_ITEMS[0]);
311
- await newTodo.press("Enter");
312
- await expect(todoCount).toContainText("1");
313
-
314
- await newTodo.fill(TODO_ITEMS[1]);
315
- await newTodo.press("Enter");
316
- await expect(todoCount).toContainText("2");
317
-
318
- await checkNumberOfTodosInLocalStorage(page, 2);
319
- });
320
- });
321
-
322
- test.describe("Clear completed button", () => {
323
- test.beforeEach(async ({ page }) => {
324
- await createDefaultTodos(page);
325
- });
326
-
327
- test("should display the correct text", async ({ page }) => {
328
- await page.locator(".todo-list li .toggle").first().check();
329
- await expect(
330
- page.getByRole("button", { name: "Clear completed" }),
331
- ).toBeVisible();
332
- });
333
-
334
- test("should remove completed items when clicked", async ({ page }) => {
335
- const todoItems = page.getByTestId("todo-item");
336
- await todoItems.nth(1).getByRole("checkbox").check();
337
- await page.getByRole("button", { name: "Clear completed" }).click();
338
- await expect(todoItems).toHaveCount(2);
339
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
340
- });
341
-
342
- test("should be hidden when there are no items that are completed", async ({
343
- page,
344
- }) => {
345
- await page.locator(".todo-list li .toggle").first().check();
346
- await page.getByRole("button", { name: "Clear completed" }).click();
347
- await expect(
348
- page.getByRole("button", { name: "Clear completed" }),
349
- ).toBeHidden();
350
- });
351
- });
352
-
353
- test.describe("Persistence", () => {
354
- test("should persist its data", async ({ page }) => {
355
- // create a new todo locator
356
- const newTodo = page.getByPlaceholder("What needs to be done?");
357
-
358
- for (const item of TODO_ITEMS.slice(0, 2)) {
359
- await newTodo.fill(item);
360
- await newTodo.press("Enter");
361
- }
362
-
363
- const todoItems = page.getByTestId("todo-item");
364
- const firstTodoCheck = todoItems.nth(0).getByRole("checkbox");
365
- await firstTodoCheck.check();
366
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);
367
- await expect(firstTodoCheck).toBeChecked();
368
- await expect(todoItems).toHaveClass(["completed", ""]);
369
-
370
- // Ensure there is 1 completed item.
371
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
372
-
373
- // Now reload.
374
- await page.reload();
375
- await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);
376
- await expect(firstTodoCheck).toBeChecked();
377
- await expect(todoItems).toHaveClass(["completed", ""]);
378
- });
379
- });
380
-
381
- test.describe("Routing", () => {
382
- test.beforeEach(async ({ page }) => {
383
- await createDefaultTodos(page);
384
- // make sure the app had a chance to save updated todos in storage
385
- // before navigating to a new view, otherwise the items can get lost :(
386
- // in some frameworks like Durandal
387
- await checkTodosInLocalStorage(page, TODO_ITEMS[0]);
388
- });
389
-
390
- test("should allow me to display active items", async ({ page }) => {
391
- const todoItem = page.getByTestId("todo-item");
392
- await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();
393
-
394
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
395
- await page.getByRole("link", { name: "Active" }).click();
396
- await expect(todoItem).toHaveCount(2);
397
- await expect(todoItem).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
398
- });
399
-
400
- test("should respect the back button", async ({ page }) => {
401
- const todoItem = page.getByTestId("todo-item");
402
- await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();
403
-
404
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
405
-
406
- await test.step("Showing all items", async () => {
407
- await page.getByRole("link", { name: "All" }).click();
408
- await expect(todoItem).toHaveCount(3);
409
- });
410
-
411
- await test.step("Showing active items", async () => {
412
- await page.getByRole("link", { name: "Active" }).click();
413
- });
414
-
415
- await test.step("Showing completed items", async () => {
416
- await page.getByRole("link", { name: "Completed" }).click();
417
- });
418
-
419
- await expect(todoItem).toHaveCount(1);
420
- await page.goBack();
421
- await expect(todoItem).toHaveCount(2);
422
- await page.goBack();
423
- await expect(todoItem).toHaveCount(3);
424
- });
425
-
426
- test("should allow me to display completed items", async ({ page }) => {
427
- await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();
428
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
429
- await page.getByRole("link", { name: "Completed" }).click();
430
- await expect(page.getByTestId("todo-item")).toHaveCount(1);
431
- });
432
-
433
- test("should allow me to display all items", async ({ page }) => {
434
- await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();
435
- await checkNumberOfCompletedTodosInLocalStorage(page, 1);
436
- await page.getByRole("link", { name: "Active" }).click();
437
- await page.getByRole("link", { name: "Completed" }).click();
438
- await page.getByRole("link", { name: "All" }).click();
439
- await expect(page.getByTestId("todo-item")).toHaveCount(3);
440
- });
441
-
442
- test("should highlight the currently applied filter", async ({ page }) => {
443
- await expect(page.getByRole("link", { name: "All" })).toHaveClass(
444
- "selected",
445
- );
446
-
447
- //create locators for active and completed links
448
- const activeLink = page.getByRole("link", { name: "Active" });
449
- const completedLink = page.getByRole("link", { name: "Completed" });
450
- await activeLink.click();
451
-
452
- // Page change - active items.
453
- await expect(activeLink).toHaveClass("selected");
454
- await completedLink.click();
455
-
456
- // Page change - completed items.
457
- await expect(completedLink).toHaveClass("selected");
458
- });
459
- });
460
-
461
- async function createDefaultTodos(page) {
462
- // create a new todo locator
463
- const newTodo = page.getByPlaceholder("What needs to be done?");
464
-
465
- for (const item of TODO_ITEMS) {
466
- await newTodo.fill(item);
467
- await newTodo.press("Enter");
468
- }
469
- }
470
-
471
- /**
472
- * @param {import('@playwright/test').Page} page
473
- * @param {number} expected
474
- */
475
- async function checkNumberOfTodosInLocalStorage(page, expected) {
476
- return await page.waitForFunction((e) => {
477
- return JSON.parse(localStorage["react-todos"]).length === e;
478
- }, expected);
479
- }
480
-
481
- /**
482
- * @param {import('@playwright/test').Page} page
483
- * @param {number} expected
484
- */
485
- async function checkNumberOfCompletedTodosInLocalStorage(page, expected) {
486
- return await page.waitForFunction((e) => {
487
- return (
488
- JSON.parse(localStorage["react-todos"]).filter((i) => i.completed)
489
- .length === e
490
- );
491
- }, expected);
492
- }
493
-
494
- /**
495
- * @param {import('@playwright/test').Page} page
496
- * @param {string} title
497
- */
498
- async function checkTodosInLocalStorage(page, title) {
499
- return await page.waitForFunction((t) => {
500
- return JSON.parse(localStorage["react-todos"])
501
- .map((i) => i.title)
502
- .includes(t);
503
- }, title);
504
- }