Welcome to mirror list, hosted at ThFree Co, Russian Federation.

exports.spec.js « interfaces « acceptance « test « mocha-3.1.0 « lib « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08db71200b372d9ceb913fed545b1c05ccbeb902 (plain)
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
var calls = [];

exports.Array = {
  before: function(){
    calls.push('before');
  },

  after: function(){
    calls.push('after');
    expect(calls).to.eql([
        'before'
      , 'before each'
      , 'one'
      , 'after each'
      , 'before each'
      , 'two'
      , 'after each'
      , 'after']);
  },

  '#indexOf()': {
    beforeEach: function(){
      calls.push('before each');
    },

    afterEach: function(){
      calls.push('after each');
    },

    'should return -1 when the value is not present': function(){
      calls.push('one');
      expect([1,2,3].indexOf(5)).to.equal(-1);
      expect([1,2,3].indexOf(0)).to.equal(-1);
    },

    'should return the correct index when the value is present': function(){
      calls.push('two');
      expect([1,2,3].indexOf(1)).to.equal(0);
      expect([1,2,3].indexOf(2)).to.equal(1);
      expect([1,2,3].indexOf(3)).to.equal(2);
    }
  }
};