1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/__helper/expects.ts
Juan Picado 93468211d6
chore: update eslint dependencies (#2126)
* chore: update eslint

* chore: update rules and style

* chore: aling formatting

* chore: update ci rules

* chore: aling formatting

* chore: aling formatting
2021-03-14 08:42:46 +01:00

20 lines
600 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;
}