0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/test/unit/__helper/expects.ts
Juan Picado @jotadeveloper c264f944fb
fix: unpublish and add or remove star colision (#1434)
* fix: unpublish and add or remove star colision

The issue was the npm star use a similar payload, but we did not check properly the shape of the payload, this fix and allow unpublish correctly.

Improve unit testing for publishing and unpublishing
Add new code documentation for future changes.

* chore: update secrets baseline

* chore: add missing type

this will requires update types in the future
2019-08-10 13:38:06 +02:00

20 lines
589 B
TypeScript

import {DIST_TAGS, LATEST} from "../../../src/lib/constants";
/**
* Verify whether the package tag match with the desired version.
*/
export function getTaggedVersionFromPackage(pkg, pkgName, tag: string = LATEST, version: string) {
// extract the tagged version
const taggedVersion = pkg[DIST_TAGS][tag];
expect(taggedVersion).toBeDefined();
expect(taggedVersion).toEqual(version);
// the version must exist
const latestPkg = pkg.versions[taggedVersion];
expect(latestPkg).toBeDefined();
// the name must match
expect(latestPkg.name).toEqual(pkgName);
return latestPkg;
}