Open robmoore-i opened 3 years ago
Example of having swappable dependencies
Things you can google:
function MyComponent => {
let jenkinsAdaptor = new JenkinsAdaptor()
render() {
let myData = jenkinsAdaptor.getTestCounts()
<TestCountsChart data={myData}>...</TestCountsChart>
}
}
class JenkinsAdaptor {
// Returns a JSON object
getTestCounts() {
// In the real implementation, I make a HTTP call to the backend
// But! I'm just testing. So I'll return some constant data.
return {
"successes": 5,
"failures": 3,
"cancelled": 1,
"count": 9,
"avgTimeSeconds": 10,
}
}
}