YouAndWeb_TwoToc
a98e8d4c8be3c9266abcdd007f47a6b1c3ed9599
YouAndWeb_TwoToc / .fr-KzWVa7 / twotoc / server / api / show / index.spec.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
'use strict'; var proxyquire = require('proxyquire').noPreserveCache(); var showCtrlStub = { index: 'showCtrl.index', show: 'showCtrl.show', create: 'showCtrl.create', update: 'showCtrl.update', destroy: 'showCtrl.destroy' }; var routerStub = { get: sinon.spy(), put: sinon.spy(), patch: sinon.spy(), post: sinon.spy(), delete: sinon.spy() }; // require the index with our stubbed out modules var showIndex = proxyquire('./index.js', { 'express': { Router: function() { return routerStub; } }, './show.controller': showCtrlStub }); describe('Show API Router:', function() { it('should return an express router instance', function() { showIndex.should.equal(routerStub); }); describe('GET /api/shows', function() { it('should route to show.controller.index', function() { routerStub.get .withArgs('/', 'showCtrl.index') .should.have.been.calledOnce; }); }); describe('GET /api/shows/:id', function() { it('should route to show.controller.show', function() { routerStub.get .withArgs('/:id', 'showCtrl.show') .should.have.been.calledOnce; }); }); describe('POST /api/shows', function() { it('should route to show.controller.create', function() { routerStub.post .withArgs('/', 'showCtrl.create') .should.have.been.calledOnce; }); }); describe('PUT /api/shows/:id', function() { it('should route to show.controller.update', function() { routerStub.put .withArgs('/:id', 'showCtrl.update') .should.have.been.calledOnce; }); }); describe('PATCH /api/shows/:id', function() { it('should route to show.controller.update', function() { routerStub.patch .withArgs('/:id', 'showCtrl.update') .should.have.been.calledOnce; }); }); describe('DELETE /api/shows/:id', function() { it('should route to show.controller.destroy', function() { routerStub.delete .withArgs('/:id', 'showCtrl.destroy') .should.have.been.calledOnce; }); }); }); |
Commits for YouAndWeb_TwoToc.fr-KzWVa7/twotoc/server/api/show/index.spec.js
Revision | Author | Commited | Message |
---|---|---|---|
a98e8d ... | FSinnona | Thu 26 Nov, 2015 13:26:45 +0000 | Creazione organizza |