<commit_before>import React, {Component} from 'react'
import {Card} from './components'

const hStyle = {
  fontFamily:'sans-serif',
  fontWeight:'normal',
  fontSize:'1.2em',
  margin:0,
  padding:0,
  marginBottom:'12px',
}

const TestSuccess = props =>
  <h4 style={{...hStyle, color:'green'}}>✔ {props.children}</h4>

const TestFailure = props => (
  <div>
    <h4 style={{...hStyle, color:'red'}}>✘ {props.children}</h4>
    <p style={{fontFamily:'monospace'}}>{props.error.toString()}</p>
  </div>
)

export default class TestCard extends Component {
  constructor(props) {
    super(props)
    this.state = {results: []}
  }
  componentWillReceiveProps(nextProps) {
    //TODO
    this.runTests(nextProps.testModule)
  }
  componentDidMount() {
    //TODO
    this.runTests(this.props.testModule)
  }
  runTests(testModule) {
    console.log('running tests', Object.keys(testModule))
    const results = []
    const tests = Object.keys(testModule)
    tests.forEach(name => {
      try {
        testModule[name]()
        results.push([true, name])
      } catch(e) {
        results.push([e, name])
      }
    })
    console.log(results)
    this.setState({results})
  }
  render() {
    const {title, doc} = this.props
    return (
      <Card {...{title, doc}}>
      {this.state.results.map(([result, name], index) => (
        result === true
          ? <TestSuccess key={index}>{name}</TestSuccess>
          : <TestFailure key={index} error={result}>{name}</TestFailure>
        )
      )}
      </Card>
    )
  }
}
<commit_msg>Remove console logs<commit_after>import React, {Component} from 'react'
import {Card} from './components'

const hStyle = {
  fontFamily:'sans-serif',
  fontWeight:'normal',
  fontSize:'1.2em',
  margin:0,
  padding:0,
  marginBottom:'12px',
}

const TestSuccess = props =>
  <h4 style={{...hStyle, color:'green'}}>✔ {props.children}</h4>

const TestFailure = props => (
  <div>
    <h4 style={{...hStyle, color:'red'}}>✘ {props.children}</h4>
    <p style={{fontFamily:'monospace'}}>{props.error.toString()}</p>
  </div>
)

export default class TestCard extends Component {
  constructor(props) {
    super(props)
    this.state = {results: []}
  }
  componentWillReceiveProps(nextProps) {
    //TODO
    this.runTests(nextProps.testModule)
  }
  componentDidMount() {
    //TODO
    this.runTests(this.props.testModule)
  }
  runTests(testModule) {
    const results = []
    const tests = Object.keys(testModule)
    tests.forEach(name => {
      try {
        testModule[name]()
        results.push([true, name])
      } catch(e) {
        results.push([e, name])
      }
    })
    this.setState({results})
  }
  render() {
    const {title, doc} = this.props
    return (
      <Card {...{title, doc}}>
      {this.state.results.map(([result, name], index) => (
        result === true
          ? <TestSuccess key={index}>{name}</TestSuccess>
          : <TestFailure key={index} error={result}>{name}</TestFailure>
        )
      )}
      </Card>
    )
  }
}

{'fraction_non_alphanumeric': 0.17844112769485904, 'fraction_numerical': 0.006633499170812604, 'mean_word_length': 2.8766066838046274, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '604771', 'n_tokens_mistral': 1025, 'n_tokens_neox': 1026, 'n_words': 178}