Files
cnpmcore/test/common/adapter/NpmRegistry.test.ts
fengmk2 4427a4fca5 feat: use egg v4 (#747)
BREAKING CHANGE: only support egg >= 4.0.0

the first app on egg v4

https://github.com/eggjs/egg/issues/3644
2025-02-09 15:43:24 +08:00

25 lines
842 B
TypeScript

import { strict as assert } from 'node:assert';
import { app, mock } from '@eggjs/mock/bootstrap';
import { NPMRegistry } from '../../../app/common/adapter/NPMRegistry';
describe('test/common/adapter/CacheAdapter.test.ts', () => {
let npmRegistry: NPMRegistry;
beforeEach(async () => {
npmRegistry = await app.getEggObject(NPMRegistry);
mock(app.config.cnpmcore, 'registry', 'https://registry.npmjs.org');
});
describe('setRegistryHost()', () => {
it('default registry', async () => {
assert(npmRegistry.registry === 'https://registry.npmjs.org');
});
it('should work', async () => {
assert(npmRegistry.registry);
const host = 'https://registry.npmmirror.com';
npmRegistry.setRegistryHost(host);
assert(npmRegistry.registry === 'https://registry.npmmirror.com');
});
});
});