1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00
shields/services/docsrs/docsrs.tester.js
Pierre-Yves Bigourdan 8698fa1838
Update documentation and tests to [docsrs] (#10240)
* Update documentation and tests to [docsrs]

* Fix language identifier

* Replace tensorflow with tokio
2024-06-10 07:13:42 +00:00

50 lines
1.2 KiB
JavaScript

import Joi from 'joi'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('Docs with no version specified')
.get('/tokio.json')
.expectBadge({
label: 'docs',
message: Joi.allow('passing', 'failing'),
})
t.create('Passing docs for version').get('/tokio/1.37.0.json').expectBadge({
label: 'docs@1.37.0',
message: 'passing',
color: 'brightgreen',
})
t.create('Failing docs for version').get('/tokio/1.32.1.json').expectBadge({
label: 'docs@1.32.1',
message: 'failing',
color: 'red',
})
t.create('Multiple builds, latest passing')
.get('/bevy_tweening/0.3.1.json')
.expectBadge({
label: 'docs@0.3.1',
message: 'passing',
color: 'brightgreen',
})
t.create('Getting latest version works')
.get('/rand/latest.json')
.expectBadge({
label: 'docs',
message: Joi.allow('passing', 'failing'),
})
t.create('Crate not found')
.get('/not-a-crate/latest.json')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Version not found')
.get('/tokio/0.8.json')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Malformed version')
.get('/tokio/not-a-version.json')
.expectBadge({ label: 'docs', message: 'malformed version' })