2022-08-03 01:01:27 -05:00
|
|
|
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
|
|
|
|
2022-09-02 13:40:12 -05:00
|
|
|
import { pnpm } from './utils';
|
2022-08-03 01:01:27 -05:00
|
|
|
|
2022-09-19 16:10:38 -05:00
|
|
|
describe('search a package', () => {
|
2022-08-03 01:01:27 -05:00
|
|
|
jest.setTimeout(10000);
|
|
|
|
let registry;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
const setup = await initialSetup();
|
|
|
|
registry = setup.registry;
|
|
|
|
await registry.init();
|
|
|
|
});
|
|
|
|
|
2022-09-19 16:10:38 -05:00
|
|
|
test('should search a package', async () => {
|
2022-09-02 13:40:12 -05:00
|
|
|
const resp = await pnpm(
|
|
|
|
{},
|
2022-09-19 16:10:38 -05:00
|
|
|
'search',
|
|
|
|
'@verdaccio/cli',
|
2022-08-03 01:01:27 -05:00
|
|
|
'--json',
|
|
|
|
...addRegistry(registry.getRegistryUrl())
|
|
|
|
);
|
|
|
|
const parsedBody = JSON.parse(resp.stdout as string);
|
2022-09-19 16:10:38 -05:00
|
|
|
const pkgFind = parsedBody.find((item) => {
|
|
|
|
return item.name === '@verdaccio/cli';
|
|
|
|
});
|
|
|
|
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
2022-08-03 01:01:27 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
registry.stop();
|
|
|
|
});
|
|
|
|
});
|