mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Initial commit of asset queuing (#97)
* Initial commit of asset queuing * Addresssing comments
This commit is contained in:
committed by
Dan Zajdband
parent
c1a7b95705
commit
b0f01cf00f
@@ -1,9 +0,0 @@
|
||||
const expect = require('chai').expect;
|
||||
|
||||
describe('Comment', () => {
|
||||
describe('#add', () => {
|
||||
it('should add a comment', () => {
|
||||
expect(0).to.be.equal(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,3 @@
|
||||
require('../utils/mongoose');
|
||||
|
||||
const Action = require('../../models/action');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/* eslint-env node, mocha */
|
||||
|
||||
require('../utils/mongoose');
|
||||
|
||||
const Asset = require('../../models/asset');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -74,35 +70,4 @@ describe('Asset: model', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#upsert', ()=> {
|
||||
it('should insert an asset with no id', () => {
|
||||
return Asset.upsert({url: 'http://newasset.test.com'})
|
||||
.then((asset) => {
|
||||
expect(asset).to.have.property('id');
|
||||
});
|
||||
});
|
||||
|
||||
it('should update an asset when the id exists', () => {
|
||||
return Asset.upsert({id: 1, url: 'http://new.test.com'})
|
||||
.then((asset) => {
|
||||
expect(asset).to.have.property('id')
|
||||
.and.to.equal('1');
|
||||
expect(asset).to.have.property('url')
|
||||
.and.to.equal('http://new.test.com');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#removeAll', ()=> {
|
||||
it('should insert an asset with no id', () => {
|
||||
return Asset.removeAll({id:1})
|
||||
.then(() => {
|
||||
return Asset.findById(1);
|
||||
})
|
||||
.then((result) => {
|
||||
expect(result).to.be.null;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require('../utils/mongoose');
|
||||
|
||||
const Comment = require('../../models/comment');
|
||||
const User = require('../../models/user');
|
||||
const Action = require('../../models/action');
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/* eslint-env node, mocha */
|
||||
|
||||
require('../utils/mongoose');
|
||||
|
||||
const Setting = require('../../models/setting');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require('../utils/mongoose');
|
||||
|
||||
const User = require('../../models/user');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
const mongoose = require('../../mongoose');
|
||||
|
||||
// Ensure the NODE_ENV is set to 'test',
|
||||
// this is helpful when you would like to change behavior when testing.
|
||||
process.env.NODE_ENV = 'test';
|
||||
const mongoose = require('../mongoose');
|
||||
|
||||
beforeEach(function (done) {
|
||||
function clearDB() {
|
||||
@@ -1,4 +1,4 @@
|
||||
const authorization = require('../../middleware/authorization');
|
||||
const authorization = require('../middleware/authorization');
|
||||
|
||||
// Add the passport middleware here before it's setup.
|
||||
authorization.middleware.push((req, res, next) => {
|
||||
@@ -1,36 +1,10 @@
|
||||
require('../../../utils/mongoose');
|
||||
const passport = require('../../../utils/passport');
|
||||
describe('/assets', () => {
|
||||
|
||||
const chai = require('chai');
|
||||
const server = require('../../../../app');
|
||||
describe('GET', () => {
|
||||
|
||||
// Setup chai.
|
||||
chai.should();
|
||||
chai.use(require('chai-http'));
|
||||
it('should return assets that we search for');
|
||||
it('should not return assets that we do not search for');
|
||||
|
||||
describe('Asset: routes', () => {
|
||||
|
||||
describe('/GET Asset', () => {
|
||||
describe('#get', () => {
|
||||
it('It should get an empty array when there are no assets.', (done) => {
|
||||
|
||||
chai.request(server)
|
||||
.get('/api/v1/asset')
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.end((err, res) => {
|
||||
|
||||
if (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
|
||||
res.should.have.status(200);
|
||||
res.body.should.be.a('array');
|
||||
res.body.length.should.be.eql(0);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require('../../../utils/mongoose');
|
||||
|
||||
const app = require('../../../../app');
|
||||
const chai = require('chai');
|
||||
const expect = chai.expect;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
require('../../../utils/mongoose');
|
||||
const passport = require('../../../utils/passport');
|
||||
const passport = require('../../../passport');
|
||||
|
||||
const app = require('../../../../app');
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
require('../../../utils/mongoose');
|
||||
const passport = require('../../../utils/passport');
|
||||
const passport = require('../../../passport');
|
||||
|
||||
const app = require('../../../../app');
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
require('../../../utils/mongoose');
|
||||
const passport = require('../../../utils/passport');
|
||||
const passport = require('../../../passport');
|
||||
|
||||
const app = require('../../../../app');
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require('../../../utils/mongoose');
|
||||
|
||||
const app = require('../../../../app');
|
||||
const chai = require('chai');
|
||||
const expect = chai.expect;
|
||||
@@ -92,8 +90,8 @@ describe('api/stream: routes', () => {
|
||||
.then(res => {
|
||||
expect(res).to.have.status(200);
|
||||
expect(res.body.assets.length).to.equal(1);
|
||||
expect(res.body.comments.length).to.equal(1);
|
||||
expect(res.body.users.length).to.equal(1);
|
||||
expect(res.body.comments.length).to.equal(2);
|
||||
expect(res.body.users.length).to.equal(2);
|
||||
expect(res.body.actions.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
describe('scraper: services', () => {
|
||||
describe('#create', () => {
|
||||
it('should create a new kue job');
|
||||
});
|
||||
|
||||
describe('#scrape', () => {
|
||||
it('should scrape complete information');
|
||||
it('should scrape what it can');
|
||||
});
|
||||
|
||||
describe('#update', () => {
|
||||
it('should update the database record entries from the meta');
|
||||
});
|
||||
|
||||
describe('#process', () => {
|
||||
it('should start the processor to scrape assets');
|
||||
});
|
||||
|
||||
describe('#shutdown', () => {
|
||||
it('should shutdown the job processor');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user