mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 11:02:12 +03:00
perf(test): speed up nostr profile fuzz
This commit is contained in:
@@ -98,7 +98,10 @@ describe("profile unicode attacks", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("handles excessive combining characters (Zalgo text)", () => {
|
it("handles excessive combining characters (Zalgo text)", () => {
|
||||||
const zalgo = "t̷̢̧̨̡̛̛̛͎̩̝̪̲̲̞̠̹̗̩͓̬̱̪̦͙̬̲̤͙̱̫̝̪̱̫̯̬̭̠̖̲̥̖̫̫̤͇̪̣̫̪̖̱̯̣͎̯̲̱̤̪̣̖̲̪̯͓̖̤̫̫̲̱̲̫̲̖̫̪̯̱̱̪̖̯e̶̡̧̨̧̛̛̛̖̪̯̱̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪s̶̨̧̛̛̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯̖̪̯̖̪̱̪̯t";
|
// Keep the source small (faster transforms) while still exercising
|
||||||
|
// "lots of combining marks" behavior.
|
||||||
|
const marks = "\u0301\u0300\u0336\u034f\u035c\u0360";
|
||||||
|
const zalgo = `t${marks.repeat(256)}e${marks.repeat(256)}s${marks.repeat(256)}t`;
|
||||||
const profile: NostrProfile = {
|
const profile: NostrProfile = {
|
||||||
name: zalgo.slice(0, 256), // Truncate to fit limit
|
name: zalgo.slice(0, 256), // Truncate to fit limit
|
||||||
};
|
};
|
||||||
@@ -453,7 +456,7 @@ describe("event creation edge cases", () => {
|
|||||||
|
|
||||||
// Create events in quick succession
|
// Create events in quick succession
|
||||||
let lastTimestamp = 0;
|
let lastTimestamp = 0;
|
||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 25; i++) {
|
||||||
const event = createProfileEvent(TEST_SK, profile, lastTimestamp);
|
const event = createProfileEvent(TEST_SK, profile, lastTimestamp);
|
||||||
expect(event.created_at).toBeGreaterThan(lastTimestamp);
|
expect(event.created_at).toBeGreaterThan(lastTimestamp);
|
||||||
lastTimestamp = event.created_at;
|
lastTimestamp = event.created_at;
|
||||||
|
|||||||
Reference in New Issue
Block a user