mirror of
https://github.com/badges/shields.git
synced 2025-11-15 10:01:09 +03:00
[PyPI] Fixes Python versions order by using proper Semver comparison (#6000)
* [PyPI] Fixes Python versions order by using proper Semver comparison * [PyPI] Adds a proper specification file for Python versions service Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
38
services/pypi/pypi-python-versions.spec.js
Normal file
38
services/pypi/pypi-python-versions.spec.js
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
|
||||
const { test, given } = require('sazerac')
|
||||
const { render } = require('./pypi-python-versions.service')
|
||||
|
||||
describe('PyPI Python Version', function () {
|
||||
test(render, function () {
|
||||
// Major versions are hidden if minor are present.
|
||||
given({ versions: ['3', '3.4', '3.5', '3.6', '2', '2.7'] }).expect({
|
||||
message: '2.7 | 3.4 | 3.5 | 3.6',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// Major versions are shown when minor are missing.
|
||||
given({ versions: ['2', '3'] }).expect({
|
||||
message: '2 | 3',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// Versions are properly sorted according to their Semver segments.
|
||||
given({ versions: ['3.10', '3.9', '3.8', '3.7', '3.6'] }).expect({
|
||||
message: '3.6 | 3.7 | 3.8 | 3.9 | 3.10',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// Only "one" version works too.
|
||||
given({ versions: ['3', '3.9'] }).expect({
|
||||
message: '3.9',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// Versions are missing...
|
||||
given({ versions: [] }).expect({
|
||||
message: 'missing',
|
||||
color: 'red',
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user