chore: lint

This commit is contained in:
coderiaser 2025-12-31 14:13:10 +02:00
parent 43edba8cb8
commit cc889bda4f
48 changed files with 64 additions and 62 deletions

View file

@ -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();
});

View file

@ -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');

View file

@ -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();

View file

@ -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) => {

View file

@ -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();
});