Explicit Cordova events section in spec
authorChristopher J. Brody <chris.brody@gmail.com>
Tue, 18 Dec 2018 13:54:46 +0000 (08:54 -0500)
committerChristopher J. Brody <chris.brody@gmail.com>
Tue, 18 Dec 2018 14:23:06 +0000 (09:23 -0500)
with forwardEventsTo method section indented

spec/events.spec.js

index 08a5498..2fa8453 100644 (file)
 
 var events = require('../src/events');
 
-describe('forwardEventsTo method', function () {
-    afterEach(function () {
-        events.forwardEventsTo(null);
-    });
-    it('Test 001 : should not go to infinite loop when trying to forward to self', function () {
-        expect(function () {
-            events.forwardEventsTo(events);
-            events.emit('log', 'test message');
-        }).not.toThrow();
-    });
-    it('Test 002 : should reset forwarding after trying to forward to self', function () {
-        var EventEmitter = require('events').EventEmitter;
-        var anotherEventEmitter = new EventEmitter();
-        var logSpy = jasmine.createSpy('logSpy');
-        anotherEventEmitter.on('log', logSpy);
+describe('Cordova events', function () {
+    describe('forwardEventsTo method', function () {
+        afterEach(function () {
+            events.forwardEventsTo(null);
+        });
+        it('Test 001 : should not go to infinite loop when trying to forward to self', function () {
+            expect(function () {
+                events.forwardEventsTo(events);
+                events.emit('log', 'test message');
+            }).not.toThrow();
+        });
+        it('Test 002 : should reset forwarding after trying to forward to self', function () {
+            var EventEmitter = require('events').EventEmitter;
+            var anotherEventEmitter = new EventEmitter();
+            var logSpy = jasmine.createSpy('logSpy');
+            anotherEventEmitter.on('log', logSpy);
 
-        events.forwardEventsTo(anotherEventEmitter);
-        events.emit('log', 'test message #1');
-        expect(logSpy).toHaveBeenCalled();
+            events.forwardEventsTo(anotherEventEmitter);
+            events.emit('log', 'test message #1');
+            expect(logSpy).toHaveBeenCalled();
 
-        logSpy.calls.reset();
+            logSpy.calls.reset();
 
-        events.forwardEventsTo(events);
-        events.emit('log', 'test message #2');
-        expect(logSpy).not.toHaveBeenCalled();
+            events.forwardEventsTo(events);
+            events.emit('log', 'test message #2');
+            expect(logSpy).not.toHaveBeenCalled();
+        });
     });
 });