Commit 5a21d885 authored by D’jalmar Gutierrez Titirico's avatar D’jalmar Gutierrez Titirico 🚲

cambios de estructura al test unitario

parent 83ed6d64
......@@ -119,7 +119,7 @@ describe('Tag API:', function() {
describe('GET /api/tags?buscar=palabra&en=nombre', function () {
var tagss;
before(function (done) {
beforeEach(function (done) {
Tag.destroy({where: {}}).then(()=> {
Tag.bulkCreate([{
nombre: "java"
......@@ -131,7 +131,7 @@ describe('Tag API:', function() {
nombre: "json"
}, {
nombre: "joomla"
}]).then(tags=> {
}],{returning: true}).then(tags=> {
tagss = tags;
done();
})
......@@ -140,25 +140,28 @@ describe('Tag API:', function() {
it("deberia realizar busqueda por nombre, la palabra java", function (done) {
request(app)
.get('/api/tags?buscar=java&en=nombre')
.get('/api/tags?palabras=java&palabras=js&en=nombre')
.set('authorization', 'Bearer ' + token)
.expect(200)
.expect('Content-Type', /json/)
.end((err, res)=> {
expect(res.body.count).to.equal(2);
expect(res.body.count).to.equal(4);
expect(res.body.rows).to.be.instanceOf(Array);
done();
});
});
it("deberia realizar busqueda por id", function (done) {
request(app)
.get('/api/tags?buscar=' + tagss[0]._id + '&en=id')
.get('/api/tags?palabras=' + tagss[0]._id + '&en=_id')
.set('authorization', 'Bearer ' + token)
.expect(200)
.expect('Content-Type', /json/)
.end((err, res)=> {
expect(res.body.count).to.equal(1);
expect(res.body.rows[0]._id).to.equal(tagss[0]._id);
done();
});
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment