Update documentation and tests to [docsrs] (#10240)

* Update documentation and tests to [docsrs]

* Fix language identifier

* Replace tensorflow with tokio
This commit is contained in:
Pierre-Yves Bigourdan
2024-06-10 09:13:42 +02:00
committed by GitHub
parent 6be6c1d59f
commit 8698fa1838
4 changed files with 109 additions and 110 deletions

View File

@@ -61,6 +61,7 @@ export default class DocsRs extends BaseJsonService {
return await this._requestJson({
schema,
url: `https://docs.rs/crate/${crate}/${version}/status.json`,
httpErrors: version ? { 400: 'malformed version' } : {},
})
}

View File

@@ -2,17 +2,32 @@ import Joi from 'joi'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('Passing docs')
.get('/tokio/0.3.0.json')
.expectBadge({ label: 'docs@0.3.0', message: 'passing' })
t.create('Docs with no version specified')
.get('/tokio.json')
.expectBadge({
label: 'docs',
message: Joi.allow('passing', 'failing'),
})
t.create('Failing docs')
.get('/tensorflow/0.16.1.json')
.expectBadge({ label: 'docs@0.16.1', message: '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' })
.expectBadge({
label: 'docs@0.3.1',
message: 'passing',
color: 'brightgreen',
})
t.create('Getting latest version works')
.get('/rand/latest.json')
@@ -26,5 +41,9 @@ t.create('Crate not found')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Version not found')
.get('/tokio/not-a-version.json')
.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' })