Skip to content

Shared Examples

Compare
Choose a tag to compare
@stalniy stalniy released this 11 Mar 10:55
· 389 commits to master since this release

The main purpose of this release was bug fixes after massive refactoring and new shared behavior feature

Features

  • ui: adds shared behavior

Bug fixes

  • variable: fixes access to parent variable inside child override definition
  • metadata: fixes metadata inheritance when for contexts without lazy vars
  • get: returns undefined when variable does not exist @iain-b

Performance

  • variable: decreases amount of afterEach callbacks. Now there is a single afterEach on root level instead of a single afterEach for each describe/context
sharedExamplesFor('a collection', () => {
  it('has three items', () => {
    expect($subject.size).to.equal(3)
  })

  describe('#has', () => {
    it('returns true with an an item that is in the collection', () => {
      expect($subject.has(7)).to.be.true
    })

    it('returns false with an an item that is not in the collection', () => {
      expect($subject.has(9)).to.be.false
    })
  })
})

describe('Set', () => {
  subject(() => new Set([1, 2, 7]))

  itBehavesLike('a collection')
})

describe('Map', () => {
  subject(() => new Map([[2, 1], [7, 5], [3, 4]]))

  itBehavesLike('a collection')
})