perf(test): speed up nostr profile fuzz

This commit is contained in:
Peter Steinberger
2026-02-14 19:28:54 +00:00
parent 387fb40745
commit 7418400c47

View File

@@ -98,7 +98,10 @@ describe("profile unicode attacks", () => {
});
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 = {
name: zalgo.slice(0, 256), // Truncate to fit limit
};
@@ -453,7 +456,7 @@ describe("event creation edge cases", () => {
// Create events in quick succession
let lastTimestamp = 0;
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 25; i++) {
const event = createProfileEvent(TEST_SK, profile, lastTimestamp);
expect(event.created_at).toBeGreaterThan(lastTimestamp);
lastTimestamp = event.created_at;