diff --git a/lib/operations/roles.js b/lib/operations/roles.js index 4bb55cf9..758ef460 100644 --- a/lib/operations/roles.js +++ b/lib/operations/roles.js @@ -6,7 +6,7 @@ const formatRoleOptions = (roleOptions = {}) => { options.push(roleOptions.superuser ? 'SUPERUSER' : 'NOSUPERUSER'); options.push(roleOptions.createdb ? 'CREATEDB' : 'NOCREATEDB'); options.push(roleOptions.createrole ? 'CREATEROLE' : 'NOCREATEROLE'); - options.push(!roleOptions.inherit ? 'NOINHERIT' : 'INHERIT'); + options.push(roleOptions.inherit === false ? 'NOINHERIT' : 'INHERIT'); options.push(roleOptions.login ? 'LOGIN' : 'NOLOGIN'); options.push(roleOptions.replication ? 'REPLICATION' : 'NOREPLICATION'); if (roleOptions.bypassrls !== undefined) { diff --git a/test/roles-test.js b/test/roles-test.js new file mode 100644 index 00000000..5bb23452 --- /dev/null +++ b/test/roles-test.js @@ -0,0 +1,11 @@ +import { expect } from 'chai'; +import * as Roles from '../lib/operations/roles'; + +describe('lib/operations/roles', () => { + describe('.create', () => { + it('check defaults', () => { + const sql = Roles.create('role'); + expect(sql).to.equal('CREATE ROLE "role" WITH NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN NOREPLICATION;'); + }); + }); +});