@samitouri / QOS-React-2 / commits / 7954a861d1

Add more complicated fourth listener to AppDispatcher-test

Joshua Ma committed May 23, 2014 at 12:42 UTC 7954a861d18d6000d04738c39912f1de3db7065e
1 file changed +12 -2
examples/todomvc-flux/js/dispatcher/__tests__/AppDispatcher-test.js
+12 -2
@@ -24,10 +24,11 @@ describe('AppDispatcher', function() {
24
25 var listener1Done = false;
26 var listener1 = function(pl) {
27 - return AppDispatcher.waitFor([index2], function() {
28 - // Second and third listeners should have now been called
27 + return AppDispatcher.waitFor([index2, index4], function() {
28 + // Second, third, and fourth listeners should have now been called
29 expect(listener2Done).toBe(true);
30 expect(listener3Done).toBe(true);
31 + expect(listener4Done).toBe(true);
32 listener1Done = true;
33 });
34 };
@@ -49,6 +50,15 @@ describe('AppDispatcher', function() {
50 };
51 var index3 = AppDispatcher.register(listener3);
52
53 + var listener4Done = false;
54 + var listener4 = function(pl) {
55 + return AppDispatcher.waitFor([index3], function() {
56 + expect(listener3Done).toBe(true);
57 + listener4Done = true;
58 + });
59 + };
60 + var index4 = AppDispatcher.register(listener4);
61 +
62 runs(function() {
63 AppDispatcher.dispatch(payload);
64 });