<commit_before>{ expect } = require 'chai'

Reactor = require 'app/flux/reactor'

FollowedPrivateChannelIdsStore = require '../stores/followedprivatechannelidsstore'
actionTypes = require '../actions/actiontypes'

describe 'FollowedPublicChannelIdsStore', ->

  beforeEach ->
    @reactor = new Reactor
    @reactor.registerStores [FollowedPrivateChannelIdsStore]

  describe '#handleLoadChannelSuccess', ->

    it 'adds followed channel id to list when its loaded', ->

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'foo' }
      }

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'bar' }
      }

      storeState = @reactor.evaluateToJS ['FollowedPrivateChannelIdsStore']

      expect(storeState.foo).to.eql 'foo'
      expect(storeState.bar).to.eql 'bar'
<commit_msg>Client: Activity: Added handleDeletePrivateChannelSuccess event handler test for followedPrivatechannelIdStore<commit_after>{ expect } = require 'chai'

Reactor = require 'app/flux/reactor'

FollowedPrivateChannelIdsStore = require '../stores/followedprivatechannelidsstore'
actionTypes = require '../actions/actiontypes'

describe 'FollowedPublicChannelIdsStore', ->

  beforeEach ->
    @reactor = new Reactor
    @reactor.registerStores [FollowedPrivateChannelIdsStore]

  describe '#handleLoadChannelSuccess', ->

    it 'adds followed channel id to list when its loaded', ->

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'foo' }
      }

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'bar' }
      }

      storeState = @reactor.evaluateToJS ['FollowedPrivateChannelIdsStore']

      expect(storeState.foo).to.eql 'foo'
      expect(storeState.bar).to.eql 'bar'


  describe '#handleDeletePrivateChannelSuccess', ->

    it 'Removes given channelId from privateMessageIds container.', ->

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'foo' }
      }

      @reactor.dispatch actionTypes.LOAD_FOLLOWED_PRIVATE_CHANNEL_SUCCESS, {
        channel: { id: 'bar' }
      }

      @reactor.dispatch actionTypes.DELETE_PRIVATE_CHANNEL_SUCCESS, { channelId: 'foo' }


      storeState = @reactor.evaluateToJS ['FollowedPrivateChannelIdsStore']

      expect(storeState.bar).to.eql 'bar'
      expect(storeState.foo).to.eql undefined
{'fraction_non_alphanumeric': 0.10441116956697694, 'fraction_numerical': 0.0, 'mean_word_length': 3.9047619047619047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3140520', 'n_tokens_mistral': 757, 'n_tokens_neox': 717, 'n_words': 138}