'use strict';

var test = require('tape');
var sinon = require('sinon');
var proxyquire = require('proxyquire');

test('routes should match expectation', function (t) {
  // arrange
  var app = {
    get: sinon.spy(),
    put: sinon.spy(),
    post: sinon.spy(),
    patch: sinon.spy(),
    delete: sinon.spy(),
    use: sinon.spy()
  };
  var list = sinon.stub();
  var images = sinon.stub();
  var errors = sinon.stub();
  var routing = proxyquire('../../controllers/routing', {
    './api/markdown/images': images,
    './api/article/list': list,
    '../lib/errors': errors
  });

  // act
  routing(app);

  // assert
  t.plan(6);
  t.ok(app.put.calledWith('/api/markdown/images', images));
  t.ok(app.get.calledWith('/api/articles', list));
  t.ok(app.get.calledWith('/'));
  t.ok(app.get.calledWith('/account/login'));
  t.ok(app.get.calledWith('/author/compose'));
  t.ok(app.use.calledWith(errors.handler));
});

@@ -104,16 +104,29 @@
 yquire')
+.noCallThru()
 ;%0A%0Atest(
@@ -350,20 +350,27 @@
 ;%0A  var 
-list
+articleFeed
  = sinon
@@ -384,17 +384,25 @@
 ;%0A  var 
-i
+markdownI
 mages = 
@@ -440,24 +440,75 @@
 non.stub();%0A
+  var transports = %7B%0A    routing: sinon.spy()%0A  %7D;%0A
   var routin
@@ -553,16 +553,75 @@
 ing', %7B%0A
+    'transports': transports,%0A    '../lib/errors': errors,%0A
     './a
@@ -641,17 +641,25 @@
 mages': 
-i
+markdownI
 mages,%0A 
@@ -679,49 +679,28 @@
 icle
-/list': list,%0A    '../lib/errors': errors
+s/feed': articleFeed
 %0A  %7D
@@ -754,9 +754,43 @@
 lan(
-6
+17);%0A  t.ok(app.get.calledWith('/')
 );%0A 
@@ -838,17 +838,25 @@
 mages', 
-i
+markdownI
 mages));
@@ -852,24 +852,25 @@
 wnImages));%0A
+%0A
   t.ok(app.g
@@ -890,58 +890,594 @@
 ('/a
-pi/articles', list));%0A  t.ok(app.get.calledWith('/
+rticles/feed', articleFeed));%0A  t.ok(app.get.calledWith('/articles'));%0A  t.ok(app.get.calledWith('/articles/archives'));%0A  t.ok(app.get.calledWith('/articles/:slug'));%0A  t.ok(app.get.calledWith('/articles/tagged/:tags'));%0A  t.ok(app.get.calledWith('/articles/search/:terms'));%0A  t.ok(app.get.calledWith('/articles/search/:terms'));%0A  t.ok(app.get.calledWith('/articles/:year(%5C%5Cd%7B4%7D)/:month(%5B01%5D%5C%5Cd)/:day(%5B0-3%5D%5C%5Cd)'));%0A  t.ok(app.get.calledWith('/articles/:year(%5C%5Cd%7B4%7D)/:month(%5B01%5D%5C%5Cd)'));%0A  t.ok(app.get.calledWith('/articles/:year(%5C%5Cd%7B4%7D)'));%0A  t.ok(app.get.calledWith('/articles/:slug
 '));
@@ -1581,19 +1581,19 @@
 .ok(app.
-use
+get
 .calledW
@@ -1600,22 +1600,77 @@
 ith(
-errors.handler
+'/author/compose/:slug'));%0A  t.ok(app.get.calledWith('/author/review'
 ));%0A

fix tests