mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Merge branch 'master' into 155910162
This commit is contained in:
@@ -96,12 +96,6 @@ module.exports = {
|
||||
|
||||
comments.logout();
|
||||
},
|
||||
'not logged in user clicks my profile tab': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const profile = embedStream.goToProfileSection();
|
||||
|
||||
profile.assert.visible('@notLoggedIn');
|
||||
},
|
||||
'admin logs in': client => {
|
||||
const { testData: { admin } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const User = require('../../../models/user');
|
||||
const Context = require('../../../graph/context');
|
||||
const errors = require('../../../errors');
|
||||
const { ErrNotAuthorized } = require('../../../errors');
|
||||
const SettingsService = require('../../../services/settings');
|
||||
|
||||
const { expect } = require('chai');
|
||||
@@ -54,7 +54,7 @@ describe('graph.Context', () => {
|
||||
throw new Error('should not reach this point');
|
||||
})
|
||||
.catch(err => {
|
||||
expect(err).to.be.equal(errors.ErrNotAuthorized);
|
||||
expect(err).to.be.an.instanceof(ErrNotAuthorized);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const Errors = require('../../../errors');
|
||||
const { ErrContainsProfanity } = require('../../../errors');
|
||||
const Wordlist = require('../../../services/wordlist');
|
||||
const SettingsService = require('../../../services/settings');
|
||||
|
||||
@@ -103,7 +103,8 @@ describe('services.Wordlist', () => {
|
||||
'content'
|
||||
);
|
||||
|
||||
expect(errors).to.have.property('banned', Errors.ErrContainsProfanity);
|
||||
expect(errors).to.have.property('banned');
|
||||
expect(errors.banned).to.be.an.instanceof(ErrContainsProfanity);
|
||||
});
|
||||
|
||||
it('does not match on bodies not containing bad words', () => {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const mongoose = require('../services/mongoose');
|
||||
|
||||
beforeAll(function(done) {
|
||||
mongoose.connection.on('open', function(err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
return done();
|
||||
});
|
||||
}, 30000);
|
||||
|
||||
beforeEach(async () => {
|
||||
await Promise.all(
|
||||
Object.keys(mongoose.connection.collections).map(collection => {
|
||||
return new Promise((resolve, reject) => {
|
||||
mongoose.connection.collections[collection].remove(function(err) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(async function() {
|
||||
await mongoose.disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user