<commit_before>'use strict';

const CircuitBrokenError = require('../lib/CircuitBrokenError');
const consts = require('../lib/consts');
const expect = require('chai').expect;

describe('CircuitBrokenError', () => {
  it('Should be an instance of error', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,
      successful: 40
    };
    const mockThreshold = 0.5;
    expect(new CircuitBrokenError(mockTotals, mockThreshold)).to.be.instanceof(Error);
  });
  it('Should contain expected properties', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,
      successful: 40
    };
    const mockThreshold = 0.5;
    const error = new CircuitBrokenError(mockTotals, mockThreshold);
    expect(error).to.have.a.property('message').that.is.a('string');
    expect(error).to.have.a.property('totals').that.is.an('object');
    expect(error).to.have.a.property('totals').that.is.an('object').that.deep.equals(mockTotals);
  });
  it('Should have expected error string with calculated failure percentage', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,<commit_msg>Remove redundant test<commit_after>'use strict';

const CircuitBrokenError = require('../lib/CircuitBrokenError');
const consts = require('../lib/consts');
const expect = require('chai').expect;

describe('CircuitBrokenError', () => {
  it('Should be an instance of error', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,
      successful: 40
    };
    const mockThreshold = 0.5;
    expect(new CircuitBrokenError(mockTotals, mockThreshold)).to.be.instanceof(Error);
  });
  it('Should contain expected properties', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,
      successful: 40
    };
    const mockThreshold = 0.5;
    const error = new CircuitBrokenError(mockTotals, mockThreshold);
    expect(error).to.have.a.property('message').that.is.a('string');
    expect(error).to.have.a.property('totals').that.is.an('object').that.deep.equals(mockTotals);
  });
  it('Should have expected error string with calculated failure percentage', () => {
    const mockTotals = {
      failed: 60,
      timedOut: 0,
      total: 100,
{'fraction_non_alphanumeric': 0.1551950898728628, 'fraction_numerical': 0.022797018851380975, 'mean_word_length': 3.3466666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '950959', 'n_tokens_mistral': 780, 'n_tokens_neox': 709, 'n_words': 152}