QubitProducts / slapdash

A lightweight JavaScript utility belt with native method override protection
http://npmjs.org/packages/slapdash
MIT License
3 stars 1 forks source link

Improve testing #31

Closed jimmed closed 8 years ago

jimmed commented 8 years ago

MAKE JAVASCRIPT GREAT AGAIN

So:

I propose replacing the outermost describe in each test suite with a describeMethod, which does something like:

natives.capture()
function describeMethod (methodName, suiteCallback) {
  describe(methodName, function () {
    describe('from bundle', function () {
      describe('with native methods', function () {
        suiteCallback(require('../dist/')[methodName])
      })
      describe('without native methods', function () {
        beforeEach(natives.override)
        afterEach(natives.restore)
      })
    })
    describe('from source', function () {
      // ... and again, but imported from ../src
    })
  })
}