diff --git a/.travis-yml b/.travis-yml
deleted file mode 100644
index 85242354a..000000000
--- a/.travis-yml
+++ /dev/null
@@ -1,3 +0,0 @@
-language: node_js
-node_js:
- - 4
diff --git a/bin/cli-settings b/bin/cli-settings
index 47acebbf9..7854942c0 100755
--- a/bin/cli-settings
+++ b/bin/cli-settings
@@ -22,7 +22,13 @@ program
.command('init')
.description('initilizes the talk settings')
.action(() => {
- const defaults = {id: '1', moderation: 'pre'};
+ const defaults = {
+ moderation: 'PRE',
+ wordlist: {
+ banned: [],
+ suspect: []
+ }
+ };
SettingsService
.init(defaults)
diff --git a/circle.yml b/circle.yml
index b9cea6fed..fb598ffe0 100644
--- a/circle.yml
+++ b/circle.yml
@@ -3,12 +3,14 @@ machine:
version: 7
services:
- docker
+ - redis
test:
override:
- - MOCHA_FILE=$CIRCLE_TEST_REPORTS/junit/test-results.xml ./node_modules/.bin/mocha tests --reporter mocha-junit-reporter
- npm run lint
- - npm run build
+ - ./bin/cli settings init
+ - sleep 5
+ - MOCHA_FILE=junit/test-results.xml NPM_PACKAGE_CONFIG_MOCHA_REPORTER=mocha-junit-reporter npm run test
deployment:
release:
diff --git a/client/coral-admin/src/containers/Community/Table.js b/client/coral-admin/src/containers/Community/Table.js
index c146e564a..54aab9879 100644
--- a/client/coral-admin/src/containers/Community/Table.js
+++ b/client/coral-admin/src/containers/Community/Table.js
@@ -65,8 +65,8 @@ class Table extends Component {
label={lang.t('community.role')}
onChange={role => this.onRoleChange(row.id, role)}>
-
-
+
+
diff --git a/client/coral-admin/src/containers/Configure/CommentSettings.js b/client/coral-admin/src/containers/Configure/CommentSettings.js
index 9fb3d75da..0ccb5f820 100644
--- a/client/coral-admin/src/containers/Configure/CommentSettings.js
+++ b/client/coral-admin/src/containers/Configure/CommentSettings.js
@@ -28,7 +28,7 @@ const updateCharCount = (updateSettings, settingsError) => (event) => {
};
const updateModeration = (updateSettings, mod) => () => {
- const moderation = mod === 'pre' ? 'post' : 'pre';
+ const moderation = mod === 'PRE' ? 'POST' : 'PRE';
updateSettings({moderation});
};
@@ -70,15 +70,15 @@ const CommentSettings = ({fetchingSettings, title, updateSettings, settingsError
return (
{title}
-
+
+ checked={settings.moderation === 'PRE'} />
{lang.t('configure.enable-pre-moderation')}
-
+
{lang.t('configure.enable-pre-moderation-text')}
diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js
index dbdb11265..fec5f9e21 100644
--- a/client/coral-configure/containers/ConfigureStreamContainer.js
+++ b/client/coral-configure/containers/ConfigureStreamContainer.js
@@ -1,6 +1,5 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
-import {compose} from 'react-apollo';
import {I18n} from '../../coral-framework';
import {updateOpenStatus, updateConfiguration} from '../../coral-framework/actions/asset';
diff --git a/client/coral-framework/helpers/response.js b/client/coral-framework/helpers/response.js
index e4e6e7c37..d6931b92c 100644
--- a/client/coral-framework/helpers/response.js
+++ b/client/coral-framework/helpers/response.js
@@ -18,7 +18,7 @@ const buildOptions = (inputOptions = {}) => {
if (options._csrf) {
switch (options.method.toLowerCase()) {
- case 'post':
+ case 'POST':
case 'put':
case 'delete':
options.headers['x-csrf-token'] = options._csrf;
diff --git a/client/coral-framework/reducers/asset.js b/client/coral-framework/reducers/asset.js
index f530f5a3d..3b50a5e24 100644
--- a/client/coral-framework/reducers/asset.js
+++ b/client/coral-framework/reducers/asset.js
@@ -24,10 +24,12 @@ export default function asset (state = initialState, action) {
.merge(action.config);
case actions.OPEN_COMMENTS:
return state
- .set('status', 'open');
+ .set('status', 'open')
+ .set('closedAt', null)
case actions.CLOSE_COMMENTS:
return state
- .set('status', 'closed');
+ .set('status', 'closed')
+ .set('closedAt', Date.now())
default:
return state;
}
diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js
index 953afbecb..54fee8319 100644
--- a/client/coral-plugin-commentbox/CommentBox.js
+++ b/client/coral-plugin-commentbox/CommentBox.js
@@ -120,7 +120,7 @@ class CommentBox extends Component {
cStyle={!length || (charCount && length > charCount) ? 'lightGrey' : 'darkGrey'}
className={`${name}-button`}
onClick={this.postComment}>
- {lang.t('post')}
+ {lang.t('POST')}
)
}
diff --git a/client/coral-settings/components/SettingsHeader.js b/client/coral-settings/components/SettingsHeader.js
index b169411db..8ed13713f 100644
--- a/client/coral-settings/components/SettingsHeader.js
+++ b/client/coral-settings/components/SettingsHeader.js
@@ -6,8 +6,9 @@ export default ({userData}) => (
{userData.displayName}
{
+
// Hiding display of users ID unless there's a use case for it.
- //{userData.profiles.map(profile => profile.id)}
+ // {userData.profiles.map(profile => profile.id)}
}
);
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 554afb29e..6f57f3918 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -916,7 +916,7 @@ definitions:
type: array
items:
type: string
- description: Roles occupied by the user (e.g. 'admin', 'moderator', etc.)
+ description: Roles occupied by the user (e.g. 'ADMIN', 'MODERATOR', etc.)
status:
type: string
description: The current status of the user in the system.
diff --git a/graph/loaders/comments.js b/graph/loaders/comments.js
index 84c6f7ed0..35463dfd0 100644
--- a/graph/loaders/comments.js
+++ b/graph/loaders/comments.js
@@ -44,16 +44,8 @@ const getCommentsByStatusAndAssetID = (context, {status = null, asset_id = null}
};
const getCommentsByActionTypeAndAssetID = (context, {action_type, asset_id = null}) => {
-
- // TODO: remove when we move the enum over to the uppercase.
- if (action_type) {
- action_type = action_type.toLowerCase();
- }
-
return ActionModel.find({
action_type,
-
- // TODO: remove when we move the enum over to the uppercase.
item_type: 'COMMENTS'
}).then((actions) => {
let comments = CommentModel.find({
diff --git a/graph/loaders/users.js b/graph/loaders/users.js
index b7f0fc573..90c661f71 100644
--- a/graph/loaders/users.js
+++ b/graph/loaders/users.js
@@ -1,8 +1,12 @@
const DataLoader = require('dataloader');
+const util = require('./util');
+
const UsersService = require('../../services/users');
-const genUserByIDs = (context, ids) => UsersService.findByIdArray(ids);
+const genUserByIDs = (context, ids) => UsersService
+ .findByIdArray(ids)
+ .then(util.singleJoinBy(ids, 'id'));
/**
* Creates a set of loaders based on a GraphQL context.
diff --git a/graph/resolvers/action.js b/graph/resolvers/action.js
index f82cefdb1..e6886653e 100644
--- a/graph/resolvers/action.js
+++ b/graph/resolvers/action.js
@@ -1,21 +1,9 @@
const Action = {
- action_type({action_type}) {
-
- // FIXME: remove once we cast the data model to have uppercase action
- // types.
- return action_type.toUpperCase();
- },
- item_type({item_type}) {
-
- // FIXME: remove once we cast the data model to have uppercase item
- // types.
- return item_type.toUpperCase();
- },
// This will load the user for the specific action. We'll limit this to the
// admin users only.
user({user_id}, _, {loaders, user}) {
- if (user.hasRole('admin')) {
+ if (user.hasRole('ADMIN')) {
return loaders.Users.getByID.load(user_id);
}
}
diff --git a/graph/resolvers/action_summary.js b/graph/resolvers/action_summary.js
index 5a2ef0994..48eff50c7 100644
--- a/graph/resolvers/action_summary.js
+++ b/graph/resolvers/action_summary.js
@@ -1,16 +1,3 @@
-const ActionSummary = {
- action_type({action_type}) {
-
- // FIXME: remove once we cast the data model to have uppercase action
- // types.
- return action_type.toUpperCase();
- },
- item_type({item_type}) {
-
- // FIXME: remove once we cast the data model to have uppercase item
- // types.
- return item_type.toUpperCase();
- }
-};
+const ActionSummary = {};
module.exports = ActionSummary;
diff --git a/graph/resolvers/comment.js b/graph/resolvers/comment.js
index d7d90918b..ce2283cda 100644
--- a/graph/resolvers/comment.js
+++ b/graph/resolvers/comment.js
@@ -8,13 +8,6 @@ const Comment = {
actions({id}, _, {loaders}) {
return loaders.Actions.getByItemID.load(id);
},
- status({status}) {
-
- // Because the status can be `null`, we do this check.
- if (status) {
- return status.toUpperCase();
- }
- },
asset({asset_id}, _, {loaders}) {
return loaders.Assets.getByID.load(asset_id);
}
diff --git a/graph/resolvers/root_query.js b/graph/resolvers/root_query.js
index 3a2499fd8..5676b4f48 100644
--- a/graph/resolvers/root_query.js
+++ b/graph/resolvers/root_query.js
@@ -1,6 +1,6 @@
const RootQuery = {
assets(_, args, {loaders, user}) {
- if (user == null || !user.hasRoles('admin')) {
+ if (user == null || !user.hasRoles('ADMIN')) {
return null;
}
@@ -25,7 +25,7 @@ const RootQuery = {
// This endpoint is used for loading moderation queues, so hide it in the
// event that we aren't an admin.
comments(_, {query}, {loaders, user}) {
- if (user == null || !user.hasRoles('admin')) {
+ if (user == null || !user.hasRoles('ADMIN')) {
return null;
}
diff --git a/graph/resolvers/user.js b/graph/resolvers/user.js
index 3d65416fa..65882feee 100644
--- a/graph/resolvers/user.js
+++ b/graph/resolvers/user.js
@@ -6,7 +6,7 @@ const User = {
// If the user is not an admin, only return comment list for the owner of
// the comments.
- if (!user.hasRoles('admin') || user.id !== id) {
+ if (!user.hasRoles('ADMIN') || user.id !== id) {
return null;
}
diff --git a/init.js b/init.js
index 71f05623f..eb17963a6 100644
--- a/init.js
+++ b/init.js
@@ -4,8 +4,7 @@ module.exports = () => Promise.all([
// Upsert the settings object.
SettingsService.init({
- id: '1',
- moderation: 'pre',
+ moderation: 'PRE',
wordlist: {
banned: [],
suspect: []
diff --git a/package.json b/package.json
index 5c375a5b4..59b31eb69 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"build-watch": "NODE_ENV=development webpack --config webpack.config.dev.js --watch",
"lint": "eslint bin/* .",
"lint-fix": "eslint bin/* . --fix",
- "test": "TEST_MODE=unit NODE_ENV=test mocha",
+ "test": "TEST_MODE=unit NODE_ENV=test mocha -R ${NPM_PACKAGE_CONFIG_MOCHA_REPORTER:-spec}",
"test-cover": "TEST_MODE=unit NODE_ENV=test istanbul cover _mocha --report text --check-coverage -- -R spec",
"pree2e": "NODE_ENV=test scripts/pree2e.sh",
"e2e": "NODE_ENV=test nightwatch",
diff --git a/routes/admin/index.js b/routes/admin/index.js
index 2a37e8f0f..d9731a1af 100644
--- a/routes/admin/index.js
+++ b/routes/admin/index.js
@@ -15,7 +15,7 @@ router.get('/login', (req, res, next) => {
});
router.get('*', (req, res) => {
- res.render('admin', {basePath: '/client/coral-admin'});
+ res.render('ADMIN', {basePath: '/client/coral-admin'});
});
module.exports = router;
diff --git a/routes/api/comments/index.js b/routes/api/comments/index.js
index c73a9f536..19346274d 100644
--- a/routes/api/comments/index.js
+++ b/routes/api/comments/index.js
@@ -22,13 +22,13 @@ router.get('/', (req, res, next) => {
} = req.query;
// everything on this route requires admin privileges besides listing comments for owner of said comments
- if (!authorization.has(req.user, 'admin') && !user_id) {
+ if (!authorization.has(req.user, 'ADMIN') && !user_id) {
next(errors.ErrNotAuthorized);
return;
}
// if the user is not an admin, only return comment list for the owner of the comments
- if (req.user.id !== user_id && !authorization.has(req.user, 'admin')) {
+ if (req.user.id !== user_id && !authorization.has(req.user, 'ADMIN')) {
next(errors.ErrNotAuthorized);
return;
}
@@ -50,7 +50,7 @@ router.get('/', (req, res, next) => {
// otherwise this will be a vulnerability if you pass user_id and something else,
// the app will return admin-level data without the proper checks
if (user_id) {
- query = CommentsService.findByUserId(user_id, authorization.has(req.user, 'admin'));
+ query = CommentsService.findByUserId(user_id, authorization.has(req.user, 'ADMIN'));
} else if (status) {
query = assetIDWrap(CommentsService.findByStatus(status === 'NEW' ? null : status));
} else if (action_type) {
@@ -85,7 +85,7 @@ router.get('/', (req, res, next) => {
});
});
-router.get('/:comment_id', authorization.needed('admin'), (req, res, next) => {
+router.get('/:comment_id', authorization.needed('ADMIN'), (req, res, next) => {
CommentsService
.findById(req.params.comment_id)
.then(comment => {
@@ -101,7 +101,7 @@ router.get('/:comment_id', authorization.needed('admin'), (req, res, next) => {
});
});
-router.delete('/:comment_id', authorization.needed('admin'), (req, res, next) => {
+router.delete('/:comment_id', authorization.needed('ADMIN'), (req, res, next) => {
CommentsService
.removeById(req.params.comment_id)
.then(() => {
@@ -112,7 +112,7 @@ router.delete('/:comment_id', authorization.needed('admin'), (req, res, next) =>
});
});
-router.put('/:comment_id/status', authorization.needed('admin'), (req, res, next) => {
+router.put('/:comment_id/status', authorization.needed('ADMIN'), (req, res, next) => {
const {
status
} = req.body;
diff --git a/routes/api/index.js b/routes/api/index.js
index b905e3b27..c40c428b4 100644
--- a/routes/api/index.js
+++ b/routes/api/index.js
@@ -3,9 +3,9 @@ const authorization = require('../../middleware/authorization');
const router = express.Router();
-router.use('/assets', authorization.needed('admin'), require('./assets'));
-router.use('/settings', authorization.needed('admin'), require('./settings'));
-router.use('/queue', authorization.needed('admin'), require('./queue'));
+router.use('/assets', authorization.needed('ADMIN'), require('./assets'));
+router.use('/settings', authorization.needed('ADMIN'), require('./settings'));
+router.use('/queue', authorization.needed('ADMIN'), require('./queue'));
router.use('/comments', authorization.needed(), require('./comments'));
router.use('/actions', authorization.needed(), require('./actions'));
@@ -15,6 +15,6 @@ router.use('/users', require('./users'));
router.use('/account', require('./account'));
// Bind the kue handler to the /kue path.
-router.use('/kue', authorization.needed('admin'), require('../../services/kue').kue.app);
+router.use('/kue', authorization.needed('ADMIN'), require('../../services/kue').kue.app);
module.exports = router;
diff --git a/routes/api/queue/index.js b/routes/api/queue/index.js
index 6ec5a5b29..c106f17f7 100644
--- a/routes/api/queue/index.js
+++ b/routes/api/queue/index.js
@@ -27,7 +27,7 @@ function gatherActionsAndUsers (comments) {
// depending on the settings. The :moderation overwrites this settings.
// Pre-moderation: New comments are shown in the moderator queues immediately.
// Post-moderation: New comments do not appear in moderation queues unless they are flagged by other users.
-router.get('/comments/pending', authorization.needed('admin'), (req, res, next) => {
+router.get('/comments/pending', authorization.needed('ADMIN'), (req, res, next) => {
const {asset_id} = req.query;
@@ -41,7 +41,7 @@ router.get('/comments/pending', authorization.needed('admin'), (req, res, next)
});
});
-router.get('/comments/rejected', authorization.needed('admin'), (req, res, next) => {
+router.get('/comments/rejected', authorization.needed('ADMIN'), (req, res, next) => {
const {asset_id} = req.query;
CommentsService.moderationQueue('REJECTED', asset_id)
@@ -54,7 +54,7 @@ router.get('/comments/rejected', authorization.needed('admin'), (req, res, next)
});
});
-router.get('/comments/flagged', authorization.needed('admin'), (req, res, next) => {
+router.get('/comments/flagged', authorization.needed('ADMIN'), (req, res, next) => {
const {asset_id} = req.query;
const assetIDWrap = (query) => {
diff --git a/routes/api/users/index.js b/routes/api/users/index.js
index 130d5bc0b..3ea3f3213 100644
--- a/routes/api/users/index.js
+++ b/routes/api/users/index.js
@@ -6,7 +6,7 @@ const CommentsService = require('../../../services/comments');
const mailer = require('../../../services/mailer');
const authorization = require('../../../middleware/authorization');
-router.get('/', authorization.needed('admin'), (req, res, next) => {
+router.get('/', authorization.needed('ADMIN'), (req, res, next) => {
const {
value = '',
field = 'created_at',
@@ -35,7 +35,7 @@ router.get('/', authorization.needed('admin'), (req, res, next) => {
.catch(next);
});
-router.post('/:user_id/role', authorization.needed('admin'), (req, res, next) => {
+router.post('/:user_id/role', authorization.needed('ADMIN'), (req, res, next) => {
UsersService
.addRoleToUser(req.params.user_id, req.body.role)
.then(() => {
@@ -44,7 +44,7 @@ router.post('/:user_id/role', authorization.needed('admin'), (req, res, next) =>
.catch(next);
});
-router.post('/:user_id/status', authorization.needed('admin'), (req, res, next) => {
+router.post('/:user_id/status', authorization.needed('ADMIN'), (req, res, next) => {
UsersService
.setStatus(req.params.user_id, req.body.status)
.then((status) => {
@@ -138,7 +138,7 @@ router.post('/:user_id/actions', authorization.needed(), (req, res, next) => {
});
});
-router.post('/:user_id/email/confirm', authorization.needed('admin'), (req, res, next) => {
+router.post('/:user_id/email/confirm', authorization.needed('ADMIN'), (req, res, next) => {
const {
user_id
} = req.params;
diff --git a/services/mongoose.js b/services/mongoose.js
index 1b9097760..c7092326f 100644
--- a/services/mongoose.js
+++ b/services/mongoose.js
@@ -57,3 +57,12 @@ mongoose.connect(url, (err) => {
});
module.exports = mongoose;
+
+// Here we include all the models that mongoose is used for, this ensures that
+// when we import mongoose that we also start up all the indexing opreations
+// here.
+require('../models/action');
+require('../models/asset');
+require('../models/comment');
+require('../models/setting');
+require('../models/user');
diff --git a/test/e2e/tests/Admin/LoginTest.js b/test/e2e/tests/Admin/LoginTest.js
index e75d29903..9babdf29b 100644
--- a/test/e2e/tests/Admin/LoginTest.js
+++ b/test/e2e/tests/Admin/LoginTest.js
@@ -1,5 +1,5 @@
module.exports = {
- '@tags': ['login', 'admin'],
+ '@tags': ['login', 'ADMIN'],
before(client) {
const embedStreamPage = client.page.embedStreamPage();
const {launchUrl} = client;
diff --git a/test/e2e/tests/EmbedStreamTests.js b/test/e2e/tests/EmbedStreamTests.js
index d572c2695..70b4c6ad0 100644
--- a/test/e2e/tests/EmbedStreamTests.js
+++ b/test/e2e/tests/EmbedStreamTests.js
@@ -20,7 +20,7 @@ module.exports = {
},
'User registers and posts a comment with premod off': client => {
client.perform((client, done) => {
- mocks.settings({moderation: 'post'})
+ mocks.settings({moderation: 'POST'})
.then(() => {
// Load Page
@@ -61,7 +61,7 @@ module.exports = {
},
'User posts a comment with premod on': client => {
client.perform((client, done) => {
- mocks.settings({moderation: 'pre'})
+ mocks.settings({moderation: 'PRE'})
.then(() => {
// Load Page
@@ -86,7 +86,7 @@ module.exports = {
},
'User replies to a comment with premod off': client => {
client.perform((client, done) => {
- mocks.settings({moderation: 'post'})
+ mocks.settings({moderation: 'POST'})
.then(() => {
// Load Page
@@ -119,7 +119,7 @@ module.exports = {
},
'User replies to a comment with premod on': client => {
client.perform((client, done) => {
- mocks.settings({moderation: 'pre'})
+ mocks.settings({moderation: 'PRE'})
// Add a mock user
.then(() => {
diff --git a/test/e2e/tests/Moderator/LoginTest.js b/test/e2e/tests/Moderator/LoginTest.js
index 3f1754a50..d04baabac 100644
--- a/test/e2e/tests/Moderator/LoginTest.js
+++ b/test/e2e/tests/Moderator/LoginTest.js
@@ -1,5 +1,5 @@
module.exports = {
- '@tags': ['login', 'moderator'],
+ '@tags': ['login', 'MODERATOR'],
before: client => {
const embedStreamPage = client.page.embedStreamPage();
const {launchUrl} = client;
diff --git a/test/routes/api/comments/index.js b/test/routes/api/comments/index.js
index d91e58402..c305f9f6b 100644
--- a/test/routes/api/comments/index.js
+++ b/test/routes/api/comments/index.js
@@ -15,7 +15,7 @@ const CommentsService = require('../../../../services/comments');
const UsersService = require('../../../../services/users');
const SettingsService = require('../../../../services/settings');
-const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
+const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
describe('/api/v1/comments', () => {
diff --git a/test/routes/api/queue/index.js b/test/routes/api/queue/index.js
index bf300a001..848cf10e6 100644
--- a/test/routes/api/queue/index.js
+++ b/test/routes/api/queue/index.js
@@ -13,7 +13,7 @@ const Action = require('../../../../models/action');
const UsersService = require('../../../../services/users');
const SettingsService = require('../../../../services/settings');
-const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['banned'], suspect: ['suspect']}};
+const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['banned'], suspect: ['suspect']}};
describe('/api/v1/queue', () => {
const comments = [{
diff --git a/test/routes/api/settings/index.js b/test/routes/api/settings/index.js
index c6a1fd1a7..dfe846edf 100644
--- a/test/routes/api/settings/index.js
+++ b/test/routes/api/settings/index.js
@@ -8,7 +8,7 @@ chai.should();
chai.use(require('chai-http'));
const SettingsService = require('../../../../services/settings');
-const defaults = {id: '1', moderation: 'pre'};
+const defaults = {id: '1', moderation: 'PRE'};
describe('/api/v1/settings', () => {
@@ -25,7 +25,7 @@ describe('/api/v1/settings', () => {
.then((res) => {
expect(res).to.have.status(200);
expect(res).to.be.json;
- expect(res.body).to.have.property('moderation', 'pre');
+ expect(res.body).to.have.property('moderation', 'PRE');
});
});
});
@@ -36,14 +36,14 @@ describe('/api/v1/settings', () => {
return chai.request(app)
.put('/api/v1/settings')
.set(passport.inject({roles: ['ADMIN']}))
- .send({moderation: 'post'})
+ .send({moderation: 'POST'})
.then((res) => {
expect(res).to.have.status(204);
return SettingsService.retrieve();
})
.then((settings) => {
- expect(settings).to.have.property('moderation', 'post');
+ expect(settings).to.have.property('moderation', 'POST');
});
});
});
diff --git a/test/routes/api/user/index.js b/test/routes/api/user/index.js
index f9ceac3b4..1bb36ea2c 100644
--- a/test/routes/api/user/index.js
+++ b/test/routes/api/user/index.js
@@ -6,7 +6,7 @@ const chai = require('chai');
const expect = chai.expect;
const SettingsService = require('../../../../services/settings');
-const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
+const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
// Setup chai.
chai.should();
diff --git a/test/services/assets.js b/test/services/assets.js
index c748a9797..ff8d9e175 100644
--- a/test/services/assets.js
+++ b/test/services/assets.js
@@ -72,7 +72,7 @@ describe('services.AssetsService', () => {
expect(asset).to.have.property('settings');
expect(asset.settings).to.be.null;
- return AssetsService.overrideSettings(asset.id, {moderation: 'pre'});
+ return AssetsService.overrideSettings(asset.id, {moderation: 'PRE'});
})
.then(() => {
return AssetsService.findOrCreateByUrl('https://override.test.com/asset');
@@ -80,7 +80,7 @@ describe('services.AssetsService', () => {
.then((asset) => {
expect(asset).to.have.property('settings');
expect(asset.settings).is.an('object');
- expect(asset.settings).to.have.property('moderation', 'pre');
+ expect(asset.settings).to.have.property('moderation', 'PRE');
});
});
});
diff --git a/test/services/comments.js b/test/services/comments.js
index a2e7d3bcc..fc2105cb1 100644
--- a/test/services/comments.js
+++ b/test/services/comments.js
@@ -6,7 +6,7 @@ const UsersService = require('../../services/users');
const SettingsService = require('../../services/settings');
const CommentsService = require('../../services/comments');
-const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
+const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
const expect = require('chai').expect;
diff --git a/test/services/settings.js b/test/services/settings.js
index c99bd07a6..3620ae633 100644
--- a/test/services/settings.js
+++ b/test/services/settings.js
@@ -3,12 +3,12 @@ const expect = require('chai').expect;
describe('services.SettingsService', () => {
- beforeEach(() => SettingsService.init({moderation: 'pre', wordlist: ['donut']}));
+ beforeEach(() => SettingsService.init({moderation: 'PRE', wordlist: ['donut']}));
describe('#retrieve()', () => {
it('should have a moderation field defined', () => {
return SettingsService.retrieve().then(settings => {
- expect(settings).to.have.property('moderation').and.to.equal('pre');
+ expect(settings).to.have.property('moderation').and.to.equal('PRE');
});
});
@@ -22,10 +22,10 @@ describe('services.SettingsService', () => {
describe('#update()', () => {
it('should update the settings with a passed object', () => {
- const mockSettings = {moderation: 'post', infoBoxEnable: true, infoBoxContent: 'yeah'};
+ const mockSettings = {moderation: 'POST', infoBoxEnable: true, infoBoxContent: 'yeah'};
return SettingsService.update(mockSettings).then(updatedSettings => {
expect(updatedSettings).to.be.an('object');
- expect(updatedSettings).to.have.property('moderation').and.to.equal('post');
+ expect(updatedSettings).to.have.property('moderation').and.to.equal('POST');
expect(updatedSettings).to.have.property('infoBoxEnable', true);
expect(updatedSettings).to.have.property('infoBoxContent', 'yeah');
});
@@ -45,11 +45,11 @@ describe('services.SettingsService', () => {
return SettingsService
.retrieve()
.then((settings) => {
- let ovrSett = {moderation: 'post'};
+ let ovrSett = {moderation: 'POST'};
settings.merge(ovrSett);
- expect(settings).to.have.property('moderation', 'post');
+ expect(settings).to.have.property('moderation', 'POST');
});
});
});
diff --git a/test/services/users.js b/test/services/users.js
index 44f065531..e2e5655e4 100644
--- a/test/services/users.js
+++ b/test/services/users.js
@@ -7,7 +7,7 @@ describe('services.UsersService', () => {
let mockUsers;
beforeEach(() => {
- const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
+ const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
return SettingsService.init(settings).then(() => {
return UsersService.createLocalUsers([{
diff --git a/test/services/wordlist.js b/test/services/wordlist.js
index 183564495..6bd05e640 100644
--- a/test/services/wordlist.js
+++ b/test/services/wordlist.js
@@ -17,7 +17,7 @@ describe('services.Wordlist', () => {
};
let wordlist = new Wordlist();
- const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
+ const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}};
beforeEach(() => SettingsService.init(settings));