PHP Classes

File: public/js/lib/director/test/server/core/insert-test.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   public/js/lib/director/test/server/core/insert-test.js   Download  
File: public/js/lib/director/test/server/core/insert-test.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change:
Date: 8 years ago
Size: 1,409 bytes
 

Contents

Class file image Download
/* * insert-test.js: Tests for inserting routes into a normalized routing table. * * (C) 2011, Charlie Robbins, Paolo Fragomeni, & the Contributors. * MIT LICENSE * */ var assert = require('assert'), vows = require('vows'), director = require('../../../lib/director'); vows.describe('director/core/insert').addBatch({ "An instance of director.Router": { topic: new director.Router(), "the insert() method": { "'on', ['foo', 'bar']": function (router) { function route () { } router.insert('on', ['foo', 'bar'], route); assert.strictEqual(router.routes.foo.bar.on, route); }, "'on', ['foo', 'bar'] again": function (router) { function route () { } router.insert('on', ['foo', 'bar'], route); assert.isArray(router.routes.foo.bar.on); assert.strictEqual(router.routes.foo.bar.on.length, 2); }, "'on', ['foo', 'bar'] a third time": function (router) { function route () { } router.insert('on', ['foo', 'bar'], route); assert.isArray(router.routes.foo.bar.on); assert.strictEqual(router.routes.foo.bar.on.length, 3); }, "'get', ['fizz', 'buzz']": function (router) { function route () { } router.insert('get', ['fizz', 'buzz'], route); assert.strictEqual(router.routes.fizz.buzz.get, route); } } } }).export(module);