mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	rename finn-no to unleash
This commit is contained in:
		
							parent
							
								
									036f8ce47d
								
							
						
					
					
						commit
						dfce071ce0
					
				| @ -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) __  | ||||
| 
 | ||||
| [](https://travis-ci.org/Unleash/unleash) | ||||
| [](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 | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -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(); | ||||
|             }); | ||||
|     }); | ||||
| }); | ||||
							
								
								
									
										59
									
								
								test/unit/routes/health-check.test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								test/unit/routes/health-check.test.js
									
									
									
									
									
										Normal file
									
								
							| @ -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'); | ||||
|         }); | ||||
| }); | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user