YUKI Hiroshi
null+****@clear*****
Thu Feb 7 17:04:28 JST 2013
YUKI Hiroshi 2013-02-07 17:04:28 +0900 (Thu, 07 Feb 2013) New Revision: e1e8353df2bbc9d97f7743a0ad6f5d3e2c3309d4 https://github.com/groonga/express-kotoumi/commit/e1e8353df2bbc9d97f7743a0ad6f5d3e2c3309d4 Log: test: Update tests for plugin registerations Modified files: test/frontend-rest-adaptor.test.js test/frontend-socket.io-adaptor.test.js Modified: test/frontend-rest-adaptor.test.js (+20 -19) =================================================================== --- test/frontend-rest-adaptor.test.js 2013-02-07 16:56:38 +0900 (ddeac01) +++ test/frontend-rest-adaptor.test.js 2013-02-07 17:04:28 +0900 (07289e5) @@ -6,44 +6,45 @@ var utils = require('./test-utils'); var express = require('express'); var restAdaptor = require('../lib/frontend/rest-adaptor'); +var model = require('../lib/model'); var restCommands = require('../lib/frontend/default-commands/rest'); var Connection = require('../lib/backend/connection').Connection; suite('REST API', function() { test('registeration of plugin commands', function() { var basePlugin = { - getCommand: { - method: 'GET', + getCommand: new model.REST({ path: '/get', - requestBuilder: function() {} - }, - putCommand: { + toBackend: function() {} + }), + putCommand: new model.REST({ method: 'PUT', path: '/put', - requestBuilder: function() {} - }, - postCommand: { + toBackend: function() {} + }), + postCommand: new model.REST({ method: 'POST', path: '/post', - requestBuilder: function() {} - }, - deleteCommand: { + toBackend: function() {} + }), + deleteCommand: new model.REST({ method: 'DELETE', path: '/delete', - requestBuilder: function() {} - } + toBackend: function() {} + }), + ignored: new model.SocketCommand() }; var overridingPlugin = { - postCommand: { + postCommand: new model.REST({ method: 'POST', path: '/post/overridden', - requestBuilder: function() {} - }, - deleteCommand: { + toBackend: function() {} + }), + deleteCommand: new model.REST({ method: 'DELETE', path: '/delete/overridden', - requestBuilder: function() {} - } + toBackend: function() {} + }) }; var application = express(); Modified: test/frontend-socket.io-adaptor.test.js (+8 -18) =================================================================== --- test/frontend-socket.io-adaptor.test.js 2013-02-07 16:56:38 +0900 (ef40650) +++ test/frontend-socket.io-adaptor.test.js 2013-02-07 17:04:28 +0900 (3d526bf) @@ -6,6 +6,7 @@ var express = require('express'); var utils = require('./test-utils'); var socketIoAdaptor = require('../lib/frontend/socket.io-adaptor'); +var model = require('../lib/model'); var scoketIoCommands = require('../lib/frontend/default-commands/socket.io'); var Connection = require('../lib/backend/connection').Connection; @@ -31,26 +32,15 @@ suite('Socket.IO API', function() { test('registeration of plugin commands', function(done) { var basePlugin = { - getCommand: { - requestBuilder: function() {} - }, - putCommand: { - requestBuilder: function() {} - }, - postCommand: { - requestBuilder: function() {} - }, - deleteCommand: { - requestBuilder: function() {} - } + getCommand: new model.SocketRequestResponse(), + putCommand: new model.SocketRequestResponse(), + postCommand: new model.SocketRequestResponse(), + deleteCommand: new model.SocketRequestResponse() + ignored: new model.REST() }; var overridingPlugin = { - postCommand: { - requestBuilder: function() {} - }, - deleteCommand: { - requestBuilder: function() {} - } + postCommand: new model.SocketRequestResponse(), + deleteCommand: new model.SocketRequestResponse() }; var application = express(); -------------- next part -------------- HTML����������������������������... Download