@databases/pg-config
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -6,58 +6,41 @@ "use strict"; | ||
test('get root config', () => { | ||
expect(__1.getPgConfigSync()).toMatchInlineSnapshot(` | ||
Object { | ||
"connectionStringEnvironmentVariable": "PG_URL", | ||
"test": Object { | ||
"connectTimeoutSeconds": 20, | ||
"containerName": "pg-test", | ||
"debug": false, | ||
"image": "circleci/postgres:10.6-alpine-ram", | ||
"pgDb": "test-db", | ||
"pgUser": "test-user", | ||
}, | ||
} | ||
`); | ||
expect(__1.getPgConfigSync()).toEqual({ | ||
connectionStringEnvironmentVariable: 'PG_URL', | ||
test: { | ||
connectTimeoutSeconds: 20, | ||
containerName: 'pg-test', | ||
debug: false, | ||
image: 'postgres:10.6-alpine', | ||
pgDb: 'test-db', | ||
pgUser: 'test-user' | ||
} | ||
}); | ||
}); | ||
test('valid config', () => { | ||
expect(__1._testReadPgConfigSync(__dirname + '/fixtures/empty.json')).toMatchInlineSnapshot(` | ||
Object { | ||
"connectionStringEnvironmentVariable": "DATABASE_URL", | ||
"test": Object { | ||
"connectTimeoutSeconds": 20, | ||
"containerName": "pg-test", | ||
"debug": false, | ||
"image": "circleci/postgres:10.6-alpine-ram", | ||
"pgDb": "test-db", | ||
"pgUser": "test-user", | ||
}, | ||
} | ||
`); | ||
expect(__1._testReadPgConfigSync(__dirname + '/fixtures/override.json')).toMatchInlineSnapshot(` | ||
Object { | ||
"connectionStringEnvironmentVariable": "PG_CONNECTION", | ||
"test": Object { | ||
"connectTimeoutSeconds": 20, | ||
"containerName": "pg-test", | ||
"debug": false, | ||
"image": "circleci/postgres:10.6-alpine-ram", | ||
"pgDb": "test-db", | ||
"pgUser": "test-user", | ||
}, | ||
} | ||
`); | ||
expect(__1._testReadPgConfigSync(__dirname + '/fixtures/empty.json')).toEqual({ | ||
connectionStringEnvironmentVariable: 'DATABASE_URL', | ||
test: { | ||
connectTimeoutSeconds: 20, | ||
containerName: 'pg-test', | ||
debug: false, | ||
image: 'postgres:10.6-alpine', | ||
pgDb: 'test-db', | ||
pgUser: 'test-user' | ||
} | ||
}); | ||
expect(__1._testReadPgConfigSync(__dirname + '/fixtures/override.json')).toEqual({ | ||
connectionStringEnvironmentVariable: 'PG_CONNECTION', | ||
test: { | ||
connectTimeoutSeconds: 20, | ||
containerName: 'pg-test', | ||
debug: false, | ||
image: 'postgres:10.6-alpine', | ||
pgDb: 'test-db', | ||
pgUser: 'test-user' | ||
} | ||
}); | ||
}); | ||
test('invalid config', () => { | ||
expect(() => __1._testReadPgConfigSync(__dirname + '/fixtures/invalid.json')).toThrowErrorMatchingInlineSnapshot(` | ||
"PgConfig.connectionStringEnvironmentVariable should be string | ||
{ connectionStringEnvironmentVariable: 10, | ||
test: | ||
{ connectTimeoutSeconds: 20, | ||
containerName: 'pg-test', | ||
debug: false, | ||
image: 'circleci/postgres:10.6-alpine-ram', | ||
pgDb: 'test-db', | ||
pgUser: 'test-user' } }" | ||
`); | ||
expect(() => __1._testReadPgConfigSync(__dirname + '/fixtures/invalid.json')).toThrowError(/PgConfig.connectionStringEnvironmentVariable should be string/); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -13,3 +13,3 @@ export interface TestConfig { | ||
*/ | ||
migrationsScript?: string[]; | ||
migrationsScript?: string | string[]; | ||
/** | ||
@@ -19,3 +19,3 @@ * The docker image to use when testing | ||
* | ||
* @default "circleci/postgres:10.6-alpine-ram" | ||
* @default "postgres:10.6-alpine" | ||
*/ | ||
@@ -22,0 +22,0 @@ image: string; |
@@ -34,7 +34,12 @@ import Ajv = require('ajv'); | ||
migrationsScript: { | ||
anyOf: ({ | ||
items: { | ||
type: string; | ||
}; | ||
type: string; | ||
} | { | ||
type: string; | ||
items?: undefined; | ||
})[]; | ||
description: string; | ||
items: { | ||
type: string; | ||
}; | ||
type: string; | ||
}; | ||
@@ -41,0 +46,0 @@ pgDb: { |
@@ -27,3 +27,3 @@ "use strict"; | ||
minimum: 0, | ||
type: 'integer' | ||
type: 'number' | ||
}, | ||
@@ -41,3 +41,3 @@ containerName: { | ||
image: { | ||
default: 'circleci/postgres:10.6-alpine-ram', | ||
default: 'postgres:10.6-alpine', | ||
description: 'The docker image to use when testing\nusing @databases/pg-test', | ||
@@ -47,7 +47,11 @@ type: 'string' | ||
migrationsScript: { | ||
description: 'Optional script to run after the database\nhas been started but before running tests', | ||
items: { | ||
anyOf: [{ | ||
items: { | ||
type: 'string' | ||
}, | ||
type: 'array' | ||
}, { | ||
type: 'string' | ||
}, | ||
type: 'array' | ||
}], | ||
description: 'Optional script to run after the database\nhas been started but before running tests' | ||
}, | ||
@@ -68,3 +72,3 @@ pgDb: { | ||
minimum: 0, | ||
type: 'integer' | ||
type: 'number' | ||
} | ||
@@ -71,0 +75,0 @@ }, |
{ | ||
"name": "@databases/pg-config", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17442
354