mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
5cbee6f57f
* fix: unpublish a package on storage package fix: unpublish a package on storage package fix unpublish e2e * Update index.ts * reuse cli e2e tests * npm 10 migrated * migrate tests * migrate tests * clean up * Create hot-crews-live.md
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
|
|
import {
|
|
addRegistry,
|
|
initialSetup,
|
|
pnpmUtils,
|
|
prepareGenericEmptyProject,
|
|
} from '@verdaccio/test-cli-commons';
|
|
|
|
export function runStar(pnpm) {
|
|
describe('star a package', () => {
|
|
let registry;
|
|
|
|
beforeAll(async () => {
|
|
const setup = await initialSetup();
|
|
registry = setup.registry;
|
|
await registry.init();
|
|
});
|
|
|
|
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
|
const { tempFolder } = await prepareGenericEmptyProject(
|
|
pkgName,
|
|
'1.0.0-patch',
|
|
registry.port,
|
|
registry.getToken(),
|
|
registry.getRegistryUrl()
|
|
);
|
|
|
|
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
const resp = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'star',
|
|
pkgName,
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
|
});
|
|
|
|
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
|
const { tempFolder } = await prepareGenericEmptyProject(
|
|
pkgName,
|
|
'1.0.0-patch',
|
|
registry.port,
|
|
registry.getToken(),
|
|
registry.getRegistryUrl()
|
|
);
|
|
|
|
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
const resp = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'star',
|
|
pkgName,
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
|
|
|
const resp1 = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'unstar',
|
|
pkgName,
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
|
});
|
|
|
|
test('should list stars of a user %s', async () => {
|
|
const pkgName = '@verdaccio/stars';
|
|
const { tempFolder } = await prepareGenericEmptyProject(
|
|
pkgName,
|
|
'1.0.0-patch',
|
|
registry.port,
|
|
registry.getToken(),
|
|
registry.getRegistryUrl()
|
|
);
|
|
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await pnpm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
|
const resp = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'stars',
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
// side effects: this result is affected the the package published in the previous step
|
|
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
|
});
|
|
|
|
afterAll(async () => {
|
|
registry.stop();
|
|
});
|
|
});
|
|
}
|