diff --git a/README.md b/README.md index b5b5537baf..90e37ba38d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # unleash -__Warning: We are in the process of splitting up unleash into multiple packages in this repository, if you want to test the previous package see [previous tag](https://github.com/finn-no/unleash/tree/v1.0.0-alpha.2) __ +__Warning: We are in the process of splitting up unleash into multiple packages in this repository, if you want to test the previous package see [previous tag](https://github.com/unleash/unleash/tree/v1.0.0-alpha.2) __ [![Build Status](https://travis-ci.org/Unleash/unleash.svg?branch=master)](https://travis-ci.org/Unleash/unleash) [![Coverage Status](https://coveralls.io/repos/github/Unleash/unleash/badge.svg?branch=master)](https://coveralls.io/github/Unleash/unleash?branch=master) @@ -12,11 +12,11 @@ __Warning: We are in the process of splitting up unleash into multiple packages This repo contains the unleash-server, which contains the admin UI and a place to ask for the status of features. In order to make use of unleash you will also need a client implementation. Known client implementations: -- [unleash-client-java](https://github.com/finn-no/unleash-client-java) -- [unleash-client-node](https://github.com/finn-no/unleash-client-node) +- [unleash-client-java](https://github.com/unleash/unleash-client-java) +- [unleash-client-node](https://github.com/unleash/unleash-client-node) ## Project details -- [Project Roadmap](https://github.com/finn-no/unleash/wiki/Roadmap) +- [Project Roadmap](https://github.com/unleash/unleash/wiki/Roadmap) ## Run with docker We have set up docker-compose to start postgres and the unleash server together. This makes it really fast to start up diff --git a/package.json b/package.json index 861fc5856b..dbb35c9bd4 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,10 @@ ], "repository": { "type": "git", - "url": "ssh://git@github.com:finn-no/unleash.git" + "url": "ssh://git@github.com:unleash/unleash.git" }, "bugs": { - "url": "https://github.com/finn-no/unleash/issues" + "url": "https://github.com/unleash/unleash/issues" }, "engines": { "node": "6" diff --git a/test/unit/routes/health-check.js b/test/unit/routes/health-check.js deleted file mode 100644 index 3c71c0e4bb..0000000000 --- a/test/unit/routes/health-check.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -const store = require('./mocks/store'); - - -const supertest = require('supertest'); -const assert = require('assert'); -const sinon = require('sinon'); - -let request; -let db; - -describe('Unit: The health cheack api', () => { - beforeEach(done => { - const stores = store.createStores(); - db = stores.db; - const app = require('../../../app')({ - baseUriPath: '', - stores: stores, - }); - request = supertest(app); - done(); - }); - - it('should give 500 when db is failing', (done) => { - db.select = () => { - return { - from: () => Promise.reject(new Error('db error')) - } - } - - request - .get('/health') - .expect(500) - .end((err, res) => { - assert.equal(res.status, 500) - assert.equal(res.body.health, 'BAD'); - done(); - }); - }); - - it('should give 200 when db is not failing', (done) => { - request - .get('/health') - .expect(200, done) - }); - - it('should give health=GOOD when db is not failing', (done) => { - request - .get('/health') - .expect(200) - .end((err, res) => { - assert.equal(res.status, 200) - assert.equal(res.body.health, 'GOOD'); - done(); - }); - }); -}); diff --git a/test/unit/routes/health-check.test.js b/test/unit/routes/health-check.test.js new file mode 100644 index 0000000000..7b564f2c00 --- /dev/null +++ b/test/unit/routes/health-check.test.js @@ -0,0 +1,59 @@ +'use strict'; + +const test = require('ava'); +const store = require('./mocks/store'); +const supertest = require('supertest'); +const logger = require('../../../lib/logger'); + +test.beforeEach(() => { + logger.setLevel('FATAL'); +}); + + +function getSetup () { + const stores = store.createStores(); + const db = stores.db; + const app = require('../../../app')({ + baseUriPath: '', + stores, + }); + + return { + db, + request: supertest(app), + }; +} + +test('should give 500 when db is failing', t => { + const { request, db } = getSetup(); + db.select = () => ({ + from: () => Promise.reject(new Error('db error')), + }); + + return request + .get('/health') + .expect(500) + .expect((res) => { + t.true(res.status === 500); + t.true(res.body.health === 'BAD'); + }); +}); + +test('should give 200 when db is not failing', () => { + const { request } = getSetup(); + return request + .get('/health') + .expect(200); +}); + +test('should give health=GOOD when db is not failing', t => { + const { request } = getSetup(); + return request + .get('/health') + .expect(200) + .expect((res) => { + t.true(res.status === 200); + t.true(res.body.health === 'GOOD'); + }); +}); +