-
-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from Unleash/ava
Ava
- Loading branch information
Showing
30 changed files
with
804 additions
and
791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ unleash-server.tar.gz | |
jsconfig.json | ||
typings | ||
.vscode | ||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
'use strict'; | ||
|
||
const DBMigrate = require('db-migrate'); | ||
const path = require('path'); | ||
const { getInstance } = require('db-migrate'); | ||
const parseDbUrl = require('parse-database-url'); | ||
|
||
function migrateDb (dbUrl, schema = "public") { | ||
const custom = parseDbUrl(dbUrl); | ||
custom.schema = schema; | ||
const dbmigrate = DBMigrate.getInstance(true, { | ||
function migrateDb ({ databaseUri, databaseSchema = 'public' }) { | ||
const custom = parseDbUrl(databaseUri); | ||
custom.schema = databaseSchema; | ||
const dbmigrate = getInstance(true, { | ||
cwd: __dirname, | ||
config: { custom }, | ||
env: 'custom' } | ||
); | ||
return dbmigrate.up(); | ||
} | ||
|
||
module.exports = migrateDb; | ||
module.exports = migrateDb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
'use strict'; | ||
|
||
const specHelper = require('./util/test-helper'); | ||
let request; | ||
const test = require('ava'); | ||
const { setupApp } = require('./util/test-helper'); | ||
const logger = require('../../lib/logger'); | ||
|
||
describe('The event api', () => { | ||
beforeEach(done => { | ||
specHelper.setupApp().then((app) => { | ||
request = app.request; | ||
done(); | ||
}); | ||
}); | ||
test.beforeEach(() => { | ||
logger.setLevel('FATAL'); | ||
}); | ||
|
||
it('returns events', done => { | ||
request | ||
.get('/api/events') | ||
.expect('Content-Type', /json/) | ||
.expect(200, done); | ||
}); | ||
test.serial('returns events', async (t) => { | ||
const { request, destroy } = await setupApp('event_api_serial'); | ||
return request | ||
.get('/api/events') | ||
.expect('Content-Type', /json/) | ||
.expect(200) | ||
.then(destroy); | ||
}); | ||
|
||
it('returns events given a name', done => { | ||
request | ||
.get('/api/events/myname') | ||
.expect('Content-Type', /json/) | ||
.expect(200, done); | ||
}); | ||
test.serial('returns events given a name', async (t) => { | ||
const { request, destroy } = await setupApp('event_api_serial'); | ||
return request | ||
.get('/api/events/myname') | ||
.expect('Content-Type', /json/) | ||
.expect(200) | ||
.then(destroy); | ||
}); |
Oops, something went wrong.