source: frontend/node_modules/fast-uri/benchmark/non-simple-domain.mjs

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 838 bytes
Line 
1import { Bench } from 'tinybench'
2import { nonSimpleDomain } from '../lib/utils.js'
3
4const benchNonSimpleDomain = new Bench({ name: 'nonSimpleDomain' })
5
6const exampleCom = 'example.com'
7const exaumlmpleCom = 'exämple.com'
8const longDomain = 'abc'.repeat(100) + '.com'
9
10console.assert(nonSimpleDomain(exampleCom) === false, 'example.com should be a simple domain')
11console.assert(nonSimpleDomain(exaumlmpleCom) === true, 'exämple.com should not be a simple domain')
12console.assert(nonSimpleDomain(longDomain) === false, `${longDomain} should be a simple domain?`)
13
14benchNonSimpleDomain.add('nonSimpleDomain', function () {
15 nonSimpleDomain(exampleCom)
16 nonSimpleDomain(exaumlmpleCom)
17 nonSimpleDomain(longDomain)
18})
19
20await benchNonSimpleDomain.run()
21console.log(benchNonSimpleDomain.name)
22console.table(benchNonSimpleDomain.table())
Note: See TracBrowser for help on using the repository browser.