Update match-electron-accelerator.spec.js

This commit is contained in:
mmmsssttt404 2025-03-25 16:07:45 +08:00 committed by GitHub
parent 11c8cc1e19
commit f09b1bda77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,3 +151,14 @@ describe('Match non-character keys', () => {
}) })
) )
}) })
describe('REDoS Helpers', () => {
it('should stop in 1 second', () => {
const str = '#' + ' '.repeat(100000) + '\n1\n'
const startTime = performance.now()
getRecommendTitleFromMarkdownString(str)
const endTime = performance.now()
const timeTaken = endTime - startTime
expect(timeTaken).to.be.lessThan(1000)
})
})