2017-11-29 09:12:28 +00:00
|
|
|
// Page listing the engine's currently implemented mecanisms and their tests
|
|
|
|
import React, { Component } from 'react'
|
|
|
|
import knownMecanims from 'Engine/known-mecanisms.yaml'
|
|
|
|
import R from 'ramda'
|
2017-11-29 09:30:06 +00:00
|
|
|
import './Mecanisms.css'
|
|
|
|
|
|
|
|
let directoryLoader = require.context('../../test/mécanismes/', true, /.yaml$/),
|
|
|
|
tests = R.fromPairs(
|
|
|
|
directoryLoader
|
|
|
|
.keys()
|
|
|
|
.map(key => [
|
|
|
|
key.replace(/\/|\.|(yaml)/g, '').replace(/-/g, ' '),
|
|
|
|
directoryLoader(key)
|
|
|
|
])
|
|
|
|
)
|
2017-11-29 09:12:28 +00:00
|
|
|
|
|
|
|
export default class Mecanisms extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2017-11-29 09:30:06 +00:00
|
|
|
<ul id="mecanisms">
|
2017-11-29 09:12:28 +00:00
|
|
|
{R.toPairs(knownMecanims).map(([name, data]) => (
|
2017-11-29 09:30:06 +00:00
|
|
|
<li key={name}>
|
|
|
|
{name}
|
|
|
|
{tests[name] == null ? (
|
|
|
|
<p className="warning">Pas de tests !</p>
|
|
|
|
) : (
|
|
|
|
<p>nombre de tests {tests[name].length}</p>
|
|
|
|
)}
|
|
|
|
</li>
|
2017-11-29 09:12:28 +00:00
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|