mirror of
https://github.com/pysunday/rs-reverse.git
synced 2025-04-12 03:46:56 +08:00
feat: mock document.all and test
This commit is contained in:
parent
6973aa6850
commit
eb834cc4a9
@ -7,8 +7,8 @@
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
|
||||
"test": "jest ./test/",
|
||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand ./test/"
|
||||
},
|
||||
"logLevel": "warn",
|
||||
"author": "rnet",
|
||||
@ -23,7 +23,7 @@
|
||||
"request-promise": "^4.2.6",
|
||||
"yargs": "^17.7.2",
|
||||
"canvas": "^2.11.2",
|
||||
"jsdom": "^22.1.0",
|
||||
"jsdom": "^22.1.0"
|
||||
},
|
||||
"jest": {
|
||||
"moduleNameMapper": {
|
||||
|
23
test/documentAll-addon.test.js
Normal file
23
test/documentAll-addon.test.js
Normal file
@ -0,0 +1,23 @@
|
||||
const getDocumentAll = require('@utils/getDocumentAll').getDocumentAll;
|
||||
|
||||
describe('模拟document.all检测', () => {
|
||||
const da = getDocumentAll({ length: 1 });
|
||||
console.log(
|
||||
'运行:getDocumentAll({ length: 1 }),返回:', da,
|
||||
'\n运行:getDocumentAll({ length: 1 }) == undefined,返回:', da == undefined,
|
||||
'\n运行:getDocumentAll({ length: 1 })(),返回:', da(),
|
||||
'\n运行:typeof getDocumentAll({ length: 1 }),返回:', typeof da,
|
||||
);
|
||||
test('getDocumentAll({ length: 1 }).length === 1', () => {
|
||||
expect(da.length).toBe(1);
|
||||
});
|
||||
test('getDocumentAll({ length: 1 }) == undefined', () => {
|
||||
expect(da == undefined).toBe(true);
|
||||
});
|
||||
test('typeof getDocumentAll({ length: 1 })', () => {
|
||||
expect(typeof da).toBe('undefined');
|
||||
});
|
||||
test('getDocumentAll({ length: 1 })() === null', () => {
|
||||
expect(da()).toBe(null);
|
||||
});
|
||||
});
|
BIN
utils/getDocumentAll.node
Executable file
BIN
utils/getDocumentAll.node
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user