-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.js
33 lines (27 loc) · 999 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import assert from 'node:assert/strict'
import test from 'node:test'
import {svgElementAttributes} from './index.js'
test('svgElementAttributes', async function (t) {
await t.test('should expose the public api', async function () {
assert.deepEqual(Object.keys(await import('./index.js')).sort(), [
'svgElementAttributes'
])
})
await t.test('should be an `object`', async function () {
assert.equal(typeof svgElementAttributes, 'object')
})
await t.test('values', async function (t) {
const tagNames = Object.keys(svgElementAttributes)
for (const tagName of tagNames) {
await t.test(tagName, async function () {
const attributes = svgElementAttributes[tagName]
for (const attribute of attributes) {
assert.equal(typeof attribute, 'string')
assert.equal(attribute, attribute.trim())
assert.match(attribute, /^[a-z][a-z\d-]*$/i)
}
assert.ok(Array.isArray(attributes))
})
}
})
})