Blame view

framework/thirdparty/jasmine/spec/suites/ReporterSpec.js 1.33 KB
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  describe('jasmine.Reporter', function() {
    var env;
  
  
    beforeEach(function() {
      env = new jasmine.Env();
      env.updateInterval = 0;
    });
  
    it('should get called from the test runner', function() {
      env.describe('Suite for JSON Reporter with Callbacks', function () {
        env.it('should be a test', function() {
          this.runs(function () {
            this.expect(true).toEqual(true);
          });
        });
        env.it('should be a failing test', function() {
          this.runs(function () {
            this.expect(false).toEqual(true);
          });
        });
      });
      env.describe('Suite for JSON Reporter with Callbacks 2', function () {
        env.it('should be a test', function() {
          this.runs(function () {
            this.expect(true).toEqual(true);
          });
        });
  
      });
  
      var foo = 0;
      var bar = 0;
      var baz = 0;
  
      env.addReporter({
        reportSpecResults: function() {
          foo++;
        },
        reportSuiteResults: function() {
          bar++;
        },
        reportRunnerResults: function() {
          baz++;
        }
      });
  
      var runner = env.currentRunner();
      runner.execute();
  
      expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
      expect(bar).toEqual(2); // 'bar was expected to be 2, was ' + bar);
      expect(baz).toEqual(1); // 'baz was expected to be 1, was ' + baz);
    });
  
  });