{"size": 958, "ext": "js", "max_stars_repo_path": "test/Mediator.destroyAllContexts.spec.js", "max_stars_repo_name": "virgilioneto/simple-mediator", "max_stars_repo_stars_event_min_datetime": "2018-11-29T15:51:59.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-29T15:51:59.000Z", "max_issues_repo_path": "test/Mediator.destroyAllContexts.spec.js", "max_issues_repo_name": "virgilioneto/simple-mediator", "max_issues_repo_issues_event_min_datetime": "2018-12-01T21:10:51.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-01T21:10:51.000Z", "max_forks_repo_path": "test/Mediator.destroyAllContexts.spec.js", "max_forks_repo_name": "virgilioneto/simple-mediator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 29.0303030303, "max_line_length": 86, "alphanum_fraction": 0.6409185804}
'use strict'
const chai = require('chai')
const Mediator = require('..')
const expect = chai.expect

chai.should()

describe('Mediator#destroyAllContexts', () => {
  context('Valid operations', () => {
    it('Destroy all without get any contexts', () => {
      let result = Mediator.destroyAllContexts()
      expect(result).to.be.equal(undefined)
    })

    it('Destroy all instanced contexts', () => {
      Mediator.getContext()
      Mediator.getContext('My new Context')
      Mediator.getContext('My other Context')
      let cList = Mediator.getContextList()
      expect(cList).to.be.an('Array')
      expect(cList).to.have.length(3)
      expect(cList).to.have.members(['default', 'My new Context', 'My other Context'])

      let result = Mediator.destroyAllContexts()
      expect(result).to.be.equal(undefined)

      cList = Mediator.getContextList()
      expect(cList).to.be.an('Array')
      expect(cList).to.have.length(0)
    })
  })
})
