mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-28 18:23:35 +00:00
chore: lint
This commit is contained in:
parent
43edba8cb8
commit
cc889bda4f
48 changed files with 64 additions and 62 deletions
|
|
@ -1,20 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
const {test, stub} = require('supertape');
|
||||
|
||||
const {btoa, atob} = require('./base64');
|
||||
|
||||
test('btoa: browser', (t) => {
|
||||
const btoaOriginal = global.btoa;
|
||||
const btoaOriginal = globalThis.btoa;
|
||||
const btoaStub = stub();
|
||||
const str = 'hello';
|
||||
|
||||
global.btoa = btoaStub;
|
||||
globalThis.btoa = btoaStub;
|
||||
|
||||
btoa(str);
|
||||
global.btoa = btoaOriginal;
|
||||
globalThis.btoa = btoaOriginal;
|
||||
|
||||
t.calledWith(btoaStub, [str], 'should call global.btoa');
|
||||
t.calledWith(btoaStub, [str], 'should call globalThis.btoa');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
@ -29,18 +28,18 @@ test('btoa: node', (t) => {
|
|||
});
|
||||
|
||||
test('atob: browser', (t) => {
|
||||
const atobOriginal = global.atob;
|
||||
const atobOriginal = globalThis.atob;
|
||||
const atobStub = stub();
|
||||
|
||||
const str = 'hello';
|
||||
|
||||
global.atob = atobStub;
|
||||
globalThis.atob = atobStub;
|
||||
|
||||
atob(str);
|
||||
|
||||
global.atob = atobOriginal;
|
||||
globalThis.atob = atobOriginal;
|
||||
|
||||
t.calledWith(atobStub, [str], 'should call global.btoa');
|
||||
t.calledWith(atobStub, [str], 'should call globalThis.btoa');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const {promisify} = require('node:util');
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const {tryToCatch} = require('try-to-catch');
|
||||
|
||||
const {test, stub} = require('supertape');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('supertape');
|
||||
const tryCatch = require('try-catch');
|
||||
const {tryCatch} = require('try-catch');
|
||||
|
||||
const datetime = require('./datetime');
|
||||
|
||||
|
|
@ -16,11 +16,11 @@ test('common: datetime', (t) => {
|
|||
});
|
||||
|
||||
test('common: datetime: no arg', (t) => {
|
||||
const {Date} = global;
|
||||
const {Date} = globalThis;
|
||||
|
||||
let called = false;
|
||||
|
||||
global.Date = class extends Date {
|
||||
globalThis.Date = class extends Date {
|
||||
constructor() {
|
||||
super();
|
||||
called = true;
|
||||
|
|
@ -29,7 +29,7 @@ test('common: datetime: no arg', (t) => {
|
|||
|
||||
datetime();
|
||||
|
||||
global.Date = Date;
|
||||
globalThis.Date = Date;
|
||||
|
||||
t.ok(called, 'should call new Date');
|
||||
t.end();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const {tryToCatch} = require('try-to-catch');
|
||||
const all = Promise.all.bind(Promise);
|
||||
|
||||
module.exports = async (a) => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const test = require('supertape');
|
||||
const {reRequire} = require('mock-require');
|
||||
const tryCatch = require('try-catch');
|
||||
const {tryCatch} = require('try-catch');
|
||||
const Util = require('./util');
|
||||
|
||||
const {
|
||||
|
|
@ -119,13 +119,13 @@ test('util: escapeRegExp', (t) => {
|
|||
});
|
||||
|
||||
test('util: scope', (t) => {
|
||||
global.window = {};
|
||||
globalThis.window = {};
|
||||
|
||||
reRequire('./util');
|
||||
|
||||
t.pass('should set window in scope');
|
||||
|
||||
delete global.window;
|
||||
delete globalThis.window;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue