Skip to content

Commit b42601d

Browse files
authored
chore: new filter tests (#1552)
* add bulk of tests * refactored and improved tests * add more comments * fixes after CI run * split filter tests into mulitple suites * split filter tests into mulitple suites
1 parent 833b02a commit b42601d

11 files changed

+1176
-216
lines changed

.cspell.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@
117117
"webfonts",
118118
"websockets",
119119
"wifi",
120-
"xsalsa20"
120+
"xsalsa20",
121+
"Привет",
122+
"مرحبا"
121123
],
122124
"flagWords": [],
123125
"ignorePaths": [
@@ -142,5 +144,8 @@
142144
"pattern": "//dns4/.*/"
143145
}
144146
],
145-
"ignoreRegExpList": ["import", "multiaddr"]
147+
"ignoreRegExpList": [
148+
"import",
149+
"multiaddr"
150+
]
146151
}

package-lock.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tests/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"chai-as-promised": "^7.1.1",
6161
"debug": "^4.3.4",
6262
"dockerode": "^3.3.5",
63+
"p-retry": "^6.0.0",
6364
"p-timeout": "^6.1.0",
6465
"portfinder": "^1.0.32",
6566
"sinon": "^15.2.0",

packages/tests/src/constants.ts

+26
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,29 @@ export const NOISE_KEY_3 = new Uint8Array(
3434
return b;
3535
})()
3636
);
37+
38+
export const TEST_STRING = [
39+
{ description: "short", value: "hi" },
40+
{ description: "long", value: "A".repeat(10000) },
41+
{ description: "numeric", value: "1234567890" },
42+
{ description: "special chars", value: "!@#$%^&*()_+" },
43+
{ description: "Chinese", value: "你好" },
44+
{ description: "Arabic", value: "مرحبا" },
45+
{ description: "Russian", value: "Привет" },
46+
{ description: "SQL Injection", value: "'; DROP TABLE users; --" },
47+
{ description: "Script", value: '<script>alert("hacked");</script>' },
48+
{ description: "XML", value: "<element>Some content</element>" },
49+
{ description: "Basic HTML tag", value: "<h1>Heading</h1>" },
50+
{ description: "JSON", value: '{"user":"admin","password":"123456"}' },
51+
{ description: "shell command", value: "`rm -rf /`" },
52+
{ description: "escaped characters", value: "\\n\\t\\0" },
53+
{ description: "unicode special characters", value: "\u202Ereverse" }
54+
];
55+
56+
export const TEST_TIMESTAMPS = [
57+
BigInt(Date.now()) * BigInt(1000000),
58+
Date.now(),
59+
1649153314,
60+
1949153314000,
61+
undefined
62+
];

packages/tests/src/node/node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class NimGoNode {
348348
return `http://127.0.0.1:${this.rpcPort}/`;
349349
}
350350

351-
private async rpcCall<T>(
351+
async rpcCall<T>(
352352
method: string,
353353
params: Array<string | number | unknown>
354354
): Promise<T> {

packages/tests/tests/filter.node.spec.ts

-213
This file was deleted.

0 commit comments

Comments
 (0)