<commit_before>import expect from 'expect'
import organisations from '../../reducers/organisations'
import * as types from '../../constants/ActionTypes'

describe('organisations reducer', () => {
  it('shouild handle inital state', () => {
    expect(
      organisations(undefined, {})
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })

  it('shouild handle SELECT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        }
      ], {
        // type: types.SELECT_ORGANISATION,
        type: 'SELECT_ORGANISATION',
        id: 1
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: true,
        id: 1
      }
    ])
  })

  it('shouild handle DESELECT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: true,
          id: 1
        }
      ], {
        type: 'DESELECT_ORGANISATION',
        id: 1
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })
  
  it('shouild handle ADD_ORGANISATION', () => {
    expect(
      organisations([],  {
          type: types.ADD_ORGANISATION,
          // name: 'CodeHub Bristol'
          name: 'JavaScript 101'
        })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])

    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        }
      ], {
        type: types.ADD_ORGANISATION,
        name: 'CodeHub Bristol'
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'CodeHub Bristol',
        selected: false,
        id: 2
      }
    ])

    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: 'Code<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.ADD_ORGANISATION,
        name: 'Beetroot Cafe'
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'Code<NAME>',
        selected: false,
        id: 2
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 3
      }
    ])
  })

  it('shouild handle EDIT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.EDIT_ORGANISATION,
        name: 'Beetroot Cafe',
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 2
      }
    ])
  })

  it('shouild handle EDIT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.EDIT_ORGANISATION,
        name: 'Beetroot Cafe',
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 2
      }
    ])
  })

  it('shouild handle DELETE_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.DELETE_ORGANISATION,
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })
})<commit_msg>Resolving merge conflict.<commit_after>import expect from 'expect'
import organisations from '../../reducers/organisations'
import * as types from '../../constants/ActionTypes'

describe('organisations reducer', () => {
  it('should handle inital state', () => {
    expect(
      organisations(undefined, {})
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })

  it('should handle SELECT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        }
      ], {
        // type: types.SELECT_ORGANISATION,
        type: 'SELECT_ORGANISATION',
        id: 1
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: true,
        id: 1
      }
    ])
  })

  it('should handle DESELECT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: true,
          id: 1
        }
      ], {
        type: 'DESELECT_ORGANISATION',
        id: 1
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })

  it('should handle ADD_ORGANISATION', () => {
    expect(
      organisations([],  {
          type: types.ADD_ORGANISATION,
          // name: '<NAME>'
          name: 'JavaScript 101'
        })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])

    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        }
      ], {
        type: types.ADD_ORGANISATION,
        name: '<NAME>'
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: '<NAME>',
        selected: false,
        id: 2
      }
    ])

    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>ol',
          selected: false,
          id: 2
        }
      ], {
        type: types.ADD_ORGANISATION,
        name: 'Beetroot Cafe'
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: '<NAME>',
        selected: false,
        id: 2
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 3
      }
    ])
  })

  it('should handle EDIT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.EDIT_ORGANISATION,
        name: 'Beetroot Cafe',
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 2
      }
    ])
  })

  it('should handle EDIT_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.EDIT_ORGANISATION,
        name: 'Beetroot Cafe',
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      },
      {
        name: 'Beetroot Cafe',
        selected: false,
        id: 2
      }
    ])
  })

  it('should handle DELETE_ORGANISATION', () => {
    expect(
      organisations([
        {
          name: 'JavaScript 101',
          selected: false,
          id: 1
        },
        {
          name: '<NAME>',
          selected: false,
          id: 2
        }
      ], {
        type: types.DELETE_ORGANISATION,
        id: 2
      })
    ).toEqual([
      {
        name: 'JavaScript 101',
        selected: false,
        id: 1
      }
    ])
  })
})
{'fraction_non_alphanumeric': 0.13067084942084942, 'fraction_numerical': 0.019546332046332045, 'mean_word_length': 1.180741910023678, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 32, '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': '3086939', 'n_tokens_mistral': 2708, 'n_tokens_neox': 2499, 'n_words': 559}