Files
cnpmcore/test/core/service/PackageManagerService/block.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

29 lines
994 B
TypeScript

import { strict as assert } from 'node:assert';
import { app, mock } from '@eggjs/mock/bootstrap';
import { TestUtil } from '../../../../test/TestUtil';
import { PackageManagerService } from '../../../../app/core/service/PackageManagerService';
describe('test/core/service/PackageManagerService/block.test.ts', () => {
let packageManagerService: PackageManagerService;
beforeEach(async () => {
packageManagerService = await app.getEggObject(PackageManagerService);
});
afterEach(async () => {
mock.restore();
await TestUtil.truncateDatabase();
});
describe('block()', () => {
it('should work with name', async () => {
app.mockLog();
const { pkg } = await TestUtil.createPackage({ isPrivate: false });
const blockRes = await packageManagerService.blockPackageByFullname(pkg.name, 'xxx');
assert(blockRes.packageVersionBlockId);
assert.doesNotReject(packageManagerService.unblockPackageByFullname(pkg.name || ''));
});
});
});