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