mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Use node protocol when importing builtins
This commit is contained in:
@@ -115,7 +115,7 @@ const packageJSON = {
|
||||
},
|
||||
};
|
||||
|
||||
jest.mock('fs', (): Partial<Record<string, jest.Mock>> => ({
|
||||
jest.mock('node:fs', (): Partial<Record<string, jest.Mock>> => ({
|
||||
cwd: jest.fn((): string => __dirname),
|
||||
existsSync: jest.fn((pth: string): boolean => typeof pth === 'string' && pth in files),
|
||||
}));
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { PodCreator } from '../../../src/identity/interaction/pod/util/PodC
|
||||
import { SeededAccountInitializer } from '../../../src/init/SeededAccountInitializer';
|
||||
import { mockFileSystem } from '../../util/Util';
|
||||
|
||||
jest.mock('fs');
|
||||
jest.mock('node:fs');
|
||||
jest.mock('fs-extra');
|
||||
|
||||
describe('A SeededAccountInitializer', (): void => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { Server } from 'http';
|
||||
import { Server as HttpsServer } from 'https';
|
||||
import type { Server } from 'node:http';
|
||||
import { Server as HttpsServer } from 'node:https';
|
||||
import { ServerInitializer } from '../../../src/init/ServerInitializer';
|
||||
import type { Logger } from '../../../src/logging/Logger';
|
||||
import { getLoggerFor } from '../../../src/logging/LogUtil';
|
||||
import type { HttpServerFactory } from '../../../src/server/HttpServerFactory';
|
||||
|
||||
// Mock so we don't create an actual HTTPS server in the test below
|
||||
jest.mock('https');
|
||||
jest.mock('node:https');
|
||||
jest.mock('../../../src/logging/LogUtil');
|
||||
|
||||
describe('ServerInitializer', (): void => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import cluster from 'cluster';
|
||||
import EventEmitter from 'events';
|
||||
import { cpus } from 'os';
|
||||
import cluster from 'node:cluster';
|
||||
import EventEmitter from 'node:events';
|
||||
import { cpus } from 'node:os';
|
||||
import { ClusterManager } from '../../../../src';
|
||||
import * as LogUtil from '../../../../src/logging/LogUtil';
|
||||
|
||||
jest.mock('cluster');
|
||||
jest.mock('os', (): any => ({
|
||||
...jest.requireActual('os'),
|
||||
jest.mock('node:cluster');
|
||||
jest.mock('node:os', (): any => ({
|
||||
...jest.requireActual('node:os'),
|
||||
cpus: jest.fn().mockImplementation((): any => [{}, {}, {}, {}, {}, {}]),
|
||||
}));
|
||||
|
||||
@@ -15,7 +15,7 @@ mockWorker.process = { pid: 666 };
|
||||
|
||||
describe('A ClusterManager', (): void => {
|
||||
const emitter = new EventEmitter();
|
||||
const mockCluster = jest.requireMock('cluster');
|
||||
const mockCluster = jest.requireMock('node:cluster');
|
||||
const mockLogger = { info: jest.fn(), warn: jest.fn() };
|
||||
jest.spyOn(LogUtil, 'getLoggerFor').mockImplementation((): any => mockLogger);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ type ClientCredentials = {
|
||||
|
||||
const questionMock = jest.fn().mockImplementation((input, callback): void => callback('y'));
|
||||
const closeMock = jest.fn();
|
||||
jest.mock('readline', (): any => ({
|
||||
jest.mock('node:readline', (): any => ({
|
||||
createInterface: jest.fn().mockImplementation((): any => ({
|
||||
question: questionMock,
|
||||
close: closeMock,
|
||||
|
||||
Reference in New Issue
Block a user