Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@databases/pg-config

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@databases/pg-config - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

85

lib/__tests__/index.test.js

@@ -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

4

lib/PgConfig.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc