2022-08-03 01:01:27 -05:00
|
|
|
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
|
|
|
|
|
|
|
import { npm } from './utils';
|
|
|
|
|
2022-09-19 16:10:38 -05:00
|
|
|
describe('search a package', () => {
|
2022-09-24 04:30:16 -05:00
|
|
|
jest.setTimeout(20000);
|
2022-08-03 01:01:27 -05:00
|
|
|
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-08-03 01:01:27 -05:00
|
|
|
const resp = await npm(
|
2022-09-02 13:40:12 -05:00
|
|
|
{},
|
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();
|
|
|
|
});
|
|
|
|
});
|