test-clearSubscriptions.js 642 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. var PubSub = require('../src/pubsub'),
  3. TestHelper = require('./helper'),
  4. refute = require('referee').refute,
  5. sinon = require('sinon');
  6. describe('clearAllSubscriptions method', function () {
  7. it('must clear all subscriptions', function () {
  8. var topic = TestHelper.getUniqueString(),
  9. spy1 = sinon.spy(),
  10. spy2 = sinon.spy();
  11. PubSub.subscribe(topic, spy1);
  12. PubSub.subscribe(topic, spy2);
  13. PubSub.clearAllSubscriptions();
  14. PubSub.publishSync(topic, TestHelper.getUniqueString());
  15. refute(spy1.called);
  16. refute(spy2.called);
  17. });
  18. });