mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-07 15:09:48 -06:00
* start unit testing npm version extract * put short NPM version into trigger commit subject, close #563 * pass appVeyor token to bumpercar
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
const snapshot = require('snap-shot-it')
|
|
|
|
/* eslint-env mocha */
|
|
describe('getJustVersion', () => {
|
|
const { getJustVersion } = require('../utils')
|
|
|
|
it('returns semver if passed', () => {
|
|
snapshot(getJustVersion('0.20.1'))
|
|
})
|
|
|
|
it('returns semver with tag if passed', () => {
|
|
snapshot(getJustVersion('1.0.0-dev'))
|
|
})
|
|
|
|
it('returns name if starts with cypress', () => {
|
|
snapshot(getJustVersion('cypress@dev'))
|
|
snapshot(getJustVersion('cypress@alpha'))
|
|
snapshot(getJustVersion('cypress@0.20.3'))
|
|
})
|
|
|
|
it('returns name if matches cypress', () => {
|
|
snapshot(getJustVersion('cypress'))
|
|
})
|
|
|
|
it('extracts version from url', () => {
|
|
const url = 'https://foo.com/npm/0.20.3/develop-sha-13992/cypress.tgz'
|
|
const version = getJustVersion(url)
|
|
snapshot({ url, version })
|
|
})
|
|
|
|
it('extracts version with dev from url', () => {
|
|
const url = 'https://foo.com/npm/0.20.3-dev/develop-sha-13992/cypress.tgz'
|
|
const version = getJustVersion(url)
|
|
snapshot({ url, version })
|
|
})
|
|
|
|
it('for anything else returns the input', () => {
|
|
const url = 'babababa'
|
|
const version = getJustVersion(url)
|
|
snapshot({ url, version })
|
|
})
|
|
})
|