mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
93468211d6
* chore: update eslint * chore: update rules and style * chore: aling formatting * chore: update ci rules * chore: aling formatting * chore: aling formatting
20 lines
600 B
TypeScript
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;
|
|
}
|