Node.js based forum software built for the modern web
fix tests, #5232
Julian Lamebffc4460011
diff --git a/src/flags.js b/src/flags.jsindex 1ae5a84ed8..995e880801 100644--- a/src/flags.js+++ b/src/flags.js@@ -47,7 +47,7 @@ Flags.get = function (flagId, callback) {};Flags.list = function (filters, uid, callback) {- if (typeof filters === 'function' && !callback) {+ if (typeof filters === 'function' && !uid && !callback) {callback = filters;filters = {};}diff --git a/test/flags.js b/test/flags.jsindex 7b0252086a..607b807db3 100644--- a/test/flags.js+++ b/test/flags.js@@ -41,6 +41,11 @@ describe('Flags', function () {},function (uid, next) {Groups.join('administrators', uid, next);+ },+ function (next) {+ User.create({+ username: 'unprivileged', password: 'abcdef', email: '[email protected]'+ }, next);}], done);});@@ -109,6 +114,15 @@ describe('Flags', function () {});});});++ it('should return a filtered list of flags if said filters are passed in', function (done) {+ Flags.list({+ state: 'open'+ }, 1, function (err, flags) {+ assert.ifError(err);+ done();+ });+ });});describe('.update()', function () {@@ -221,7 +235,7 @@ describe('Flags', function () {Flags.validate({type: 'post',id: 1,- uid: 2+ uid: 3}, function (err) {assert.ok(err);assert.strictEqual('[[error:not-enough-reputation-to-flag]]', err.message);@@ -310,7 +324,9 @@ describe('Flags', function () {});it('should add a new entry into a flag\'s history', function (done) {- Flags.appendHistory(1, 1, ['state:rejected'], function (err) {+ Flags.appendHistory(1, 1, {+ state: 'rejected'+ }, function (err) {assert.ifError(err);Flags.getHistory(1, function (err, history) {@@ -329,7 +345,7 @@ describe('Flags', function () {it('should retrieve a flag\'s history', function (done) {Flags.getHistory(1, function (err, history) {assert.ifError(err);- assert.strictEqual(history[0].fields[0].value, '[[flags:state-rejected]]');+ assert.strictEqual(history[0].fields.state, '[[flags:state-rejected]]');done();});});