Make main fields more verbose, change indentation
This commit is contained in:
parent
d119d620f4
commit
bc3825b02e
2 changed files with 82 additions and 42 deletions
|
|
@ -21,8 +21,8 @@
|
||||||
"test": "npm run lint && npm run build && ava dist/tests",
|
"test": "npm run lint && npm run build && ava dist/tests",
|
||||||
"prepublish": "npm run build && del dist/tests"
|
"prepublish": "npm run build && del dist/tests"
|
||||||
},
|
},
|
||||||
"main": "dist/index",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index",
|
"types": "dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,28 @@ interface Test {
|
||||||
|
|
||||||
const types = new Map<string, Test>([
|
const types = new Map<string, Test>([
|
||||||
['undefined', {
|
['undefined', {
|
||||||
is: m.undefined, fixtures: [
|
is: m.undefined,
|
||||||
|
fixtures: [
|
||||||
undefined
|
undefined
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['null', {
|
['null', {
|
||||||
is: m.null_, fixtures: [
|
is: m.null_,
|
||||||
|
fixtures: [
|
||||||
null
|
null
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['string', {
|
['string', {
|
||||||
is: m.string, fixtures: [
|
is: m.string,
|
||||||
|
fixtures: [
|
||||||
'🦄',
|
'🦄',
|
||||||
'hello world',
|
'hello world',
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['number', {
|
['number', {
|
||||||
is: m.number, fixtures: [
|
is: m.number,
|
||||||
|
fixtures: [
|
||||||
6,
|
6,
|
||||||
1.4,
|
1.4,
|
||||||
0,
|
0,
|
||||||
|
|
@ -45,23 +49,27 @@ const types = new Map<string, Test>([
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['boolean', {
|
['boolean', {
|
||||||
is: m.boolean, fixtures: [
|
is: m.boolean,
|
||||||
|
fixtures: [
|
||||||
true, false
|
true, false
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['symbol', {
|
['symbol', {
|
||||||
is: m.symbol, fixtures: [
|
is: m.symbol,
|
||||||
|
fixtures: [
|
||||||
Symbol('🦄')
|
Symbol('🦄')
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['array', {
|
['array', {
|
||||||
is: m.array, fixtures: [
|
is: m.array,
|
||||||
|
fixtures: [
|
||||||
[1, 2],
|
[1, 2],
|
||||||
new Array(2) // tslint:disable-line:prefer-array-literal
|
new Array(2) // tslint:disable-line:prefer-array-literal
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['function', {
|
['function', {
|
||||||
is: m.function_, fixtures: [
|
is: m.function_,
|
||||||
|
fixtures: [
|
||||||
// tslint:disable:no-empty no-unused-variable only-arrow-functions no-function-expression
|
// tslint:disable:no-empty no-unused-variable only-arrow-functions no-function-expression
|
||||||
function foo() {}, // tslint:disable-line:no-unused
|
function foo() {}, // tslint:disable-line:no-unused
|
||||||
function() {},
|
function() {},
|
||||||
|
|
@ -72,162 +80,192 @@ const types = new Map<string, Test>([
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['buffer', {
|
['buffer', {
|
||||||
is: m.buffer, fixtures: [
|
is: m.buffer,
|
||||||
|
fixtures: [
|
||||||
Buffer.from('🦄')
|
Buffer.from('🦄')
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['object', {
|
['object', {
|
||||||
is: m.object, fixtures: [
|
is: m.object,
|
||||||
|
fixtures: [
|
||||||
{x: 1},
|
{x: 1},
|
||||||
Object.create({x: 1})
|
Object.create({x: 1})
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['regExp', {
|
['regExp', {
|
||||||
is: m.regExp, fixtures: [
|
is: m.regExp,
|
||||||
|
fixtures: [
|
||||||
/\w/,
|
/\w/,
|
||||||
new RegExp('\\w')
|
new RegExp('\\w')
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['date', {
|
['date', {
|
||||||
is: m.date, fixtures: [
|
is: m.date,
|
||||||
|
fixtures: [
|
||||||
new Date()
|
new Date()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['error', {
|
['error', {
|
||||||
is: m.error, fixtures: [
|
is: m.error,
|
||||||
|
fixtures: [
|
||||||
new Error('🦄'),
|
new Error('🦄'),
|
||||||
new ErrorSubclassFixture()
|
new ErrorSubclassFixture()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['nativePromise', {
|
['nativePromise', {
|
||||||
is: m.nativePromise, fixtures: [
|
is: m.nativePromise,
|
||||||
|
fixtures: [
|
||||||
Promise.resolve(),
|
Promise.resolve(),
|
||||||
// PromiseSubclassFixture.resolve()
|
// PromiseSubclassFixture.resolve()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['promise', {
|
['promise', {
|
||||||
is: m.promise, fixtures: [
|
is: m.promise,
|
||||||
|
fixtures: [
|
||||||
{then() {}, catch() {}} // tslint:disable-line:no-empty
|
{then() {}, catch() {}} // tslint:disable-line:no-empty
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['generator', {
|
['generator', {
|
||||||
is: m.generator, fixtures: [
|
is: m.generator,
|
||||||
|
fixtures: [
|
||||||
(function *() { yield 4; })() // tslint:disable-line
|
(function *() { yield 4; })() // tslint:disable-line
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['generatorFunction', {
|
['generatorFunction', {
|
||||||
is: m.generatorFunction, fixtures: [
|
is: m.generatorFunction,
|
||||||
|
fixtures: [
|
||||||
function *() { yield 4; } // tslint:disable-line
|
function *() { yield 4; } // tslint:disable-line
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['asyncFunction', {
|
['asyncFunction', {
|
||||||
is: m.asyncFunction, fixtures: [
|
is: m.asyncFunction,
|
||||||
|
fixtures: [
|
||||||
async function() {}, // tslint:disable-line:no-empty only-arrow-functions no-function-expression
|
async function() {}, // tslint:disable-line:no-empty only-arrow-functions no-function-expression
|
||||||
async () => {} // tslint:disable-line:no-empty
|
async () => {} // tslint:disable-line:no-empty
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['map', {
|
['map', {
|
||||||
is: m.map, fixtures: [
|
is: m.map,
|
||||||
|
fixtures: [
|
||||||
new Map()
|
new Map()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['set', {
|
['set', {
|
||||||
is: m.set, fixtures: [
|
is: m.set,
|
||||||
|
fixtures: [
|
||||||
new Set()
|
new Set()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['weakSet', {
|
['weakSet', {
|
||||||
is: m.weakSet, fixtures: [
|
is: m.weakSet,
|
||||||
|
fixtures: [
|
||||||
new WeakSet()
|
new WeakSet()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['weakMap', {
|
['weakMap', {
|
||||||
is: m.weakMap, fixtures: [
|
is: m.weakMap,
|
||||||
|
fixtures: [
|
||||||
new WeakMap()
|
new WeakMap()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['int8Array', {
|
['int8Array', {
|
||||||
is: m.int8Array, fixtures: [
|
is: m.int8Array,
|
||||||
|
fixtures: [
|
||||||
new Int8Array(0)
|
new Int8Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['uint8Array', {
|
['uint8Array', {
|
||||||
is: m.uint8Array, fixtures: [
|
is: m.uint8Array,
|
||||||
|
fixtures: [
|
||||||
new Uint8Array(0)
|
new Uint8Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['uint8ClampedArray', {
|
['uint8ClampedArray', {
|
||||||
is: m.uint8ClampedArray, fixtures: [
|
is: m.uint8ClampedArray,
|
||||||
|
fixtures: [
|
||||||
new Uint8ClampedArray(0)
|
new Uint8ClampedArray(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['int16Array', {
|
['int16Array', {
|
||||||
is: m.int16Array, fixtures: [
|
is: m.int16Array,
|
||||||
|
fixtures: [
|
||||||
new Int16Array(0)
|
new Int16Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['uint16Array', {
|
['uint16Array', {
|
||||||
is: m.uint16Array, fixtures: [
|
is: m.uint16Array,
|
||||||
|
fixtures: [
|
||||||
new Uint16Array(0)
|
new Uint16Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['int32Array', {
|
['int32Array', {
|
||||||
is: m.int32Array, fixtures: [
|
is: m.int32Array,
|
||||||
|
fixtures: [
|
||||||
new Int32Array(0)
|
new Int32Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['uint32Array', {
|
['uint32Array', {
|
||||||
is: m.uint32Array, fixtures: [
|
is: m.uint32Array,
|
||||||
|
fixtures: [
|
||||||
new Uint32Array(0)
|
new Uint32Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['float32Array', {
|
['float32Array', {
|
||||||
is: m.float32Array, fixtures: [
|
is: m.float32Array,
|
||||||
|
fixtures: [
|
||||||
new Float32Array(0)
|
new Float32Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['float64Array', {
|
['float64Array', {
|
||||||
is: m.float64Array, fixtures: [
|
is: m.float64Array,
|
||||||
|
fixtures: [
|
||||||
new Float64Array(0)
|
new Float64Array(0)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['arrayBuffer', {
|
['arrayBuffer', {
|
||||||
is: m.arrayBuffer, fixtures: [
|
is: m.arrayBuffer,
|
||||||
|
fixtures: [
|
||||||
new ArrayBuffer(10)
|
new ArrayBuffer(10)
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['nan', {
|
['nan', {
|
||||||
is: m.nan, fixtures: [
|
is: m.nan,
|
||||||
|
fixtures: [
|
||||||
NaN,
|
NaN,
|
||||||
Number.NaN
|
Number.NaN
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['nullOrUndefined', {
|
['nullOrUndefined', {
|
||||||
is: m.nullOrUndefined, fixtures: [
|
is: m.nullOrUndefined,
|
||||||
|
fixtures: [
|
||||||
null,
|
null,
|
||||||
undefined
|
undefined
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['plainObject', {
|
['plainObject', {
|
||||||
is: m.plainObject, fixtures: [
|
is: m.plainObject,
|
||||||
|
fixtures: [
|
||||||
{x: 1},
|
{x: 1},
|
||||||
Object.create(null),
|
Object.create(null),
|
||||||
new Object()
|
new Object()
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['integer', {
|
['integer', {
|
||||||
is: m.integer, fixtures: [
|
is: m.integer,
|
||||||
|
fixtures: [
|
||||||
6
|
6
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['safeInteger', {
|
['safeInteger', {
|
||||||
is: m.safeInteger, fixtures: [
|
is: m.safeInteger,
|
||||||
|
fixtures: [
|
||||||
Math.pow(2, 53) - 1,
|
Math.pow(2, 53) - 1,
|
||||||
-Math.pow(2, 53) + 1
|
-Math.pow(2, 53) + 1
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['domElement', {
|
['domElement', {
|
||||||
is: m.domElement, fixtures: [
|
is: m.domElement,
|
||||||
|
fixtures: [
|
||||||
'div',
|
'div',
|
||||||
'input',
|
'input',
|
||||||
'span',
|
'span',
|
||||||
|
|
@ -236,7 +274,8 @@ const types = new Map<string, Test>([
|
||||||
'script'
|
'script'
|
||||||
].map(createDomElement) }
|
].map(createDomElement) }
|
||||||
], ['non-domElements', {
|
], ['non-domElements', {
|
||||||
is: value => !m.domElement(value), fixtures: [
|
is: value => !m.domElement(value),
|
||||||
|
fixtures: [
|
||||||
document.createTextNode('data'),
|
document.createTextNode('data'),
|
||||||
document.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'),
|
document.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'),
|
||||||
document.createComment('This is a comment'),
|
document.createComment('This is a comment'),
|
||||||
|
|
@ -246,7 +285,8 @@ const types = new Map<string, Test>([
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
['infinite', {
|
['infinite', {
|
||||||
is: m.infinite, fixtures: [
|
is: m.infinite,
|
||||||
|
fixtures: [
|
||||||
Infinity,
|
Infinity,
|
||||||
-Infinity
|
-Infinity
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue