roles -> role, null -> COMMENTER for user roles

This commit is contained in:
Wyatt Johnson
2017-11-27 11:53:40 -07:00
parent 9386912b9b
commit 13865ff29e
38 changed files with 206 additions and 199 deletions
+6 -7
View File
@@ -208,15 +208,14 @@ describe('graph.mutations.createComment', () => {
beforeEach(() => AssetModel.create({id: '123'}));
[
{roles: [], tag: null},
{roles: ['ADMIN'], tag: 'STAFF'},
{roles: ['MODERATOR'], tag: 'STAFF'},
{roles: ['ADMIN', 'MODERATOR'], tag: 'STAFF'}
].forEach(({roles, tag}) => {
describe(`user.roles=${JSON.stringify(roles)}`, () => {
{role: 'COMMENTER', tag: null},
{role: 'ADMIN', tag: 'STAFF'},
{role: 'MODERATOR', tag: 'STAFF'},
].forEach(({role, tag}) => {
describe(`user.role=${JSON.stringify(role)}`, () => {
it(`creates comment ${tag ? `with tag=${tag}` : 'without tags'}`, async () => {
const context = new Context({user: new UserModel({roles})});
const context = new Context({user: new UserModel({role})});
const {data, errors} = await graphql(schema, query, {}, context);