mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
93468211d6
* chore: update eslint * chore: update rules and style * chore: aling formatting * chore: update ci rules * chore: aling formatting * chore: aling formatting
19 lines
600 B
TypeScript
19 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;
|
|
}
|