mirror of
				https://github.com/badges/shields.git
				synced 2025-11-03 15:13:18 +03:00 
			
		
		
		
	* Update documentation and tests to [docsrs] * Fix language identifier * Replace tensorflow with tokio
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			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' })
 |