* Add Downloads, Category, License, Sponge Versions, Stars, and Version badges for Ore, an API platform for Sponge Minecraft plugins * Update services/ore/ore-downloads.service.js Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com> * Replace mocked e2e tests with unit tests, fix schema and add test case for Ore License * Simplify single case forCases Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com> Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
33 lines
717 B
JavaScript
33 lines
717 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const t = (module.exports = require('../tester').createServiceTester())
|
|
|
|
// Taken from https://ore.spongepowered.org/api#/Projects/showProject
|
|
const CATEGORY_ENUM = [
|
|
'admin_tools',
|
|
'chat',
|
|
'dev_tools',
|
|
'economy',
|
|
'gameplay',
|
|
'games',
|
|
'protection',
|
|
'role_playing',
|
|
'world_management',
|
|
'misc',
|
|
]
|
|
|
|
const isInCategoryEnum = Joi.string()
|
|
.valid(...CATEGORY_ENUM.map(cat => cat.replace(/_/g, ' ')))
|
|
.required()
|
|
|
|
t.create('Nucleus (pluginId nucleus)').get('/nucleus.json').expectBadge({
|
|
label: 'category',
|
|
message: isInCategoryEnum,
|
|
})
|
|
|
|
t.create('Invalid Plugin (pluginId 1)').get('/1.json').expectBadge({
|
|
label: 'category',
|
|
message: 'not found',
|
|
})
|