import React, { PropTypes } from 'react';
import PureComponent from 'react-pure-render/component';
import { Col, Row } from 'react-bootstrap';
/* eslint-disable max-len, quotes */
const tests = [{
err: null,
text: "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof z.name === \"string\"){return true;}else{return false;}})(myDog), 'message: myDog
should contain the property name
and it should be a string
.');"
}, {
err: "message",
text: "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof z.legs === \"number\"){return true;}else{return false;}})(myDog), 'message: myDog
should contain the property legs
and it should be a number
.');"
}, {
err: "message",
text: "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof z.tails === \"number\"){return true;}else{return false;}})(myDog), 'message: myDog
should contain the property tails
and it should be a number
.');"
}, {
err: "message",
text: "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'message: myDog
should contain the property friends
and it should be an array
.');"
}, {
err: "message",
text: "assert((function(z){return Object.keys(z).length === 4;})(myDog), 'message: myDog
should only contain all the given properties.');"
}];
/* eslint-enable max-len, quotes */
export default class extends PureComponent {
static displayName = 'TestSuite';
static proptTypes = {
tests: PropTypes.arrayOf(PropTypes.object)
};
static defaultProps = {
tests: tests
};
renderTests(tests = []) {
return tests.map(({ err, text = '' }, index)=> {
var iconClass = err ?
'ion-close-circled big-error-icon' :
'ion-checkmark-circled big-success-icon';
return (