Commit 61d14b26 authored by Alexandros Georgantas's avatar Alexandros Georgantas

rename wax folder

parent 99cb21fb
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="1.0.0"></a>
# 1.0.0 (2018-02-23)
### Features
* switch to PostgreSQL ([d459299](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d459299))
### BREAKING CHANGES
* All data is now persisted in a PostgreSQL database instead of PouchDB
* Database server must be running and have an existing database before running `pubsweet setupdb` (Docker config provided)
`pubsweet start` runs `npm start` script if found and falls back to `pubsweet server`
`pubsweet server` starts the PubSweet server (like the old `pubsweet start`)
`pubsweet-server` model API is unchanged
const NodeEnvironment = require('jest-environment-node')
const pg = require('pg')
require('../editoria-authsome/test/helpers/jest-setup')
const config = require('config')
class DatabaseTestEnvironment extends NodeEnvironment {
async setup() {
await super.setup()
this.db = new pg.Client(
config['pubsweet-server'] && config['pubsweet-server'].db,
)
await this.db.connect()
// pass the test database name into the test environment as a global
this.global.__testDbName = `test_${Math.floor(Math.random() * 9999999)}`
await this.db.query(`CREATE DATABASE ${this.global.__testDbName}`)
}
async teardown() {
// terminate other connections from test before dropping db
await this.db.query(
`REVOKE CONNECT ON DATABASE ${this.global.__testDbName} FROM public`,
)
await this.db.query(`
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '${this.global.__testDbName}'`)
await this.db.query(`DROP DATABASE ${this.global.__testDbName}`)
await super.teardown()
await this.db.end()
}
}
module.exports = DatabaseTestEnvironment
{
"name": "jest-environment-db",
"version": "1.0.1",
"description": "",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jest-environment-node": "^22.1.4"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment