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