Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 33150943df

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh
clear
echo "Launching NodeBB in \"development\" mode."
echo "To run the production build of NodeBB, please use \"forever\"."
echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB"
NODE_ENV=development supervisor --extensions 'node|js|tpl' -- app $1
NODE_ENV=development supervisor --extensions 'node|js|tpl' -- app $1

@ -1,31 +1,33 @@
var express = require('express'),
var path = require('path'),
fs = require('fs'),
express = require('express'),
express_namespace = require('express-namespace'),
WebServer = express(),
server = require('http').createServer(WebServer),
RedisStore = require('connect-redis')(express),
path = require('path'),
RDB = require('./redis'),
utils = require('../public/src/utils.js'),
pkg = require('../package.json'),
fs = require('fs'),
user = require('./user.js'),
categories = require('./categories.js'),
posts = require('./posts.js'),
topics = require('./topics.js'),
notifications = require('./notifications.js'),
admin = require('./routes/admin.js'),
userRoute = require('./routes/user.js'),
apiRoute = require('./routes/api.js'),
auth = require('./routes/authentication.js'),
meta = require('./meta.js'),
feed = require('./feed'),
plugins = require('./plugins'),
nconf = require('nconf'),
winston = require('winston'),
validator = require('validator'),
async = require('async'),
logger = require('./logger.js');
pkg = require('../package.json'),
utils = require('../public/src/utils'),
RDB = require('./redis'),
user = require('./user'),
categories = require('./categories'),
posts = require('./posts'),
topics = require('./topics'),
notifications = require('./notifications'),
admin = require('./routes/admin'),
userRoute = require('./routes/user'),
apiRoute = require('./routes/api'),
auth = require('./routes/authentication'),
meta = require('./meta'),
feed = require('./feed'),
plugins = require('./plugins'),
logger = require('./logger');
(function (app) {
"use strict";
@ -144,7 +146,7 @@ var express = require('express'),
res.locals.csrf_token = req.session._csrf;
// Disable framing
res.setHeader("X-Frame-Options", "DENY");
res.setHeader('X-Frame-Options', 'DENY');
next();
});
@ -645,7 +647,7 @@ var express = require('express'),
req: req,
res: res
}, function (err, header) {
res.send(header + app.create_route("recent/" + req.params.term, null, "recent") + templates.footer);
res.send(header + app.create_route('recent/' + req.params.term, null, 'recent') + templates.footer);
});
});
@ -676,7 +678,7 @@ var express = require('express'),
req: req,
res: res
}, function (err, header) {
res.send(header + app.create_route("search/" + req.params.term, null, "search") + templates.footer);
res.send(header + app.create_route('search/' + req.params.term, null, 'search') + templates.footer);
});
});
@ -736,4 +738,4 @@ var express = require('express'),
}(WebServer));
global.server = server;
global.server = server;

@ -1,6 +1,3 @@
var winston = require('winston');
process.on('uncaughtException', function (err) {
@ -19,61 +16,64 @@ reds.createClient = function () {
var Topics = require('../src/topics');
describe('Topics', function() {
var newTopic;
var newPost;
var userInfo;
describe('Topic\'s', function() {
var topic;
beforeEach(function(){
topic = {
userId: 1,
categoryId: 1,
title: 'Test Topic Title',
content: 'The content of test topic'
};
});
describe('.post', function() {
it('should post a new topic', function(done) {
var uid = 1,
cid = 1,
title = 'Test Topic Title',
content = 'The content of test topic';
Topics.post(uid, title, content, cid, function(err, result) {
it('should create a new topic with proper parameters', function(done) {
Topics.post(topic.userId, topic.title, topic.content, topic.categoryId, function(err, result) {
assert.equal(err, null, 'was created with error');
assert.ok(result);
newTopic = result.topicData;
newPost = result.postData;
done();
});
});
it('should fail posting a topic', function(done) {
var uid = null,
cid = 1,
title = 'Test Topic Title',
content = 'The content of test topic';
it('should fail to create new topic with wrong parameters', function(done) {
topic.userId = null;
Topics.post(uid, title, content, cid, function(err, result) {
Topics.post(topic.userId, topic.title, topic.content, topic.categoryId, function(err, result) {
assert.equal(err.message, 'not-logged-in');
done();
});
});
});
describe('.getTopicData', function() {
it('should get Topic data', function(done) {
Topics.getTopicData(newTopic.tid, function(err, result) {
done.apply(this.arguments);
describe('Get methods', function() {
var newTopic;
var newPost;
beforeEach(function(done){
Topics.post(topic.userId, topic.title, topic.content, topic.categoryId, function(err, result) {
newTopic = result.topicData;
newPost = result.postData;
done();
});
});
});
describe('.getTopicData', function() {
it('should not receive errors', function(done) {
Topics.getTopicData(newTopic.tid, done);
});
});
describe('.getTopicDataWithUser', function() {
it('should get Topic data with user info', function(done) {
Topics.getTopicDataWithUser(newTopic.tid, function(err, result) {
done.apply(this.arguments);
describe('.getTopicDataWithUser', function() {
it('should not receive errors', function(done) {
Topics.getTopicDataWithUser(newTopic.tid, done);
});
});
});
after(function() {
RDB.send_command('flushdb', [], function(error){
if(error){

Loading…
Cancel
Save