js-waku/packages/tests/src/constants.ts
fbarbu15 b42601d156
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
2023-09-12 23:31:35 +02:00

63 lines
1.6 KiB
TypeScript

/**
* Some constants for test purposes.
*
* @hidden
* @module
*/
export const NOISE_KEY_1 = new Uint8Array(
((): number[] => {
const b = [];
for (let i = 0; i < 32; i++) {
b.push(1);
}
return b;
})()
);
export const NOISE_KEY_2 = new Uint8Array(
((): number[] => {
const b = [];
for (let i = 0; i < 32; i++) {
b.push(2);
}
return b;
})()
);
export const NOISE_KEY_3 = new Uint8Array(
((): number[] => {
const b = [];
for (let i = 0; i < 32; i++) {
b.push(3);
}
return b;
})()
);
export const TEST_STRING = [
{ description: "short", value: "hi" },
{ description: "long", value: "A".repeat(10000) },
{ description: "numeric", value: "1234567890" },
{ description: "special chars", value: "!@#$%^&*()_+" },
{ description: "Chinese", value: "你好" },
{ description: "Arabic", value: "مرحبا" },
{ description: "Russian", value: "Привет" },
{ description: "SQL Injection", value: "'; DROP TABLE users; --" },
{ description: "Script", value: '<script>alert("hacked");</script>' },
{ description: "XML", value: "<element>Some content</element>" },
{ description: "Basic HTML tag", value: "<h1>Heading</h1>" },
{ description: "JSON", value: '{"user":"admin","password":"123456"}' },
{ description: "shell command", value: "`rm -rf /`" },
{ description: "escaped characters", value: "\\n\\t\\0" },
{ description: "unicode special characters", value: "\u202Ereverse" }
];
export const TEST_TIMESTAMPS = [
BigInt(Date.now()) * BigInt(1000000),
Date.now(),
1649153314,
1949153314000,
undefined
];