mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
Merge branch 'master' into view-char-count
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
const mongoose = require('../mongoose');
|
||||
const mongoose = require('../services/mongoose');
|
||||
|
||||
beforeEach(function (done) {
|
||||
function clearDB() {
|
||||
|
||||
@@ -17,7 +17,8 @@ describe('/api/v1/assets', () => {
|
||||
{
|
||||
url: 'https://coralproject.net/news/asset1',
|
||||
title: 'Asset 1',
|
||||
description: 'term1'
|
||||
description: 'term1',
|
||||
id: '1'
|
||||
},
|
||||
{
|
||||
url: 'https://coralproject.net/news/asset2',
|
||||
@@ -82,4 +83,32 @@ describe('/api/v1/assets', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('#put', () => {
|
||||
it('should close the asset', function() {
|
||||
|
||||
const today = Date.now();
|
||||
|
||||
return Asset.findOrCreateByUrl('http://test.com')
|
||||
.then((asset) => {
|
||||
expect(asset).to.have.property('isClosed', null);
|
||||
expect(asset).to.have.property('closedAt', null);
|
||||
|
||||
return chai.request(app)
|
||||
.put(`/api/v1/asset/${asset.id}/status`)
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.send({closedAt: today});
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
expect(res).to.have.status(204);
|
||||
|
||||
return Asset.findByUrl('http://test.com');
|
||||
})
|
||||
.then((asset) => {
|
||||
expect(asset).to.have.property('isClosed', true);
|
||||
expect(asset).to.have.property('closedAt').and.to.not.equal(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const mongoose = require('../../mongoose');
|
||||
const mongoose = require('../../services/mongoose');
|
||||
|
||||
// Ensure the NODE_ENV is set to 'test',
|
||||
// this is helpful when you would like to change behavior when testing.
|
||||
|
||||
Reference in New Issue
Block a user