Skip to content

Latest commit

 

History

History

test

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Testing DADI Web

Include the test helper

var TestHelper = require(path.join(__dirname, '/../help'))()

Test Structure

describe('Test Description', function(done) {
  beforeEach(function(done) {
    done()
  })

  afterEach(function(done) {
    done()
  })

  it('should do something special') // a pending test

  it('should do something else', function(done) {
    // test something
    done()
  })
})

Reset Configuration

beforeEach(function(done) {
  TestHelper.resetConfig().then(() => {
    done()
  })
})

Start the server, for sending "real" requests

var pages = TestHelper.setUpPages()

TestHelper.startServer(pages).then(() => {
  var client = request(connectionString)
  client
  .get('/test')
  .end(function (err, res) {
    res.statusCode.should.eql(200)
    done()
  })
})

Cleaning up

afterEach(function (done) {
  TestHelper.stopServer(done)
})

Setting configuration values

var cacheConfig = {
  caching: {
    directory: {
      enabled: true
    }
  }
}

TestHelper.updateConfig(cacheConfig).then(() => {
  // test something
  done()
})