YUKI Hiroshi
null+****@clear*****
Fri Oct 4 18:50:31 JST 2013
YUKI Hiroshi 2013-10-04 18:50:31 +0900 (Fri, 04 Oct 2013) New Revision: 08100ba2d0895cc04765c9e2e8a845a666184038 https://github.com/droonga/express-droonga/commit/08100ba2d0895cc04765c9e2e8a845a666184038 Message: Add test for builtin droonga command Modified files: test/adapter/rest.test.js Modified: test/adapter/rest.test.js (+37 -0) =================================================================== --- test/adapter/rest.test.js 2013-10-04 18:50:14 +0900 (6e5c087) +++ test/adapter/rest.test.js 2013-10-04 18:50:31 +0900 (efff37b) @@ -220,6 +220,43 @@ suite('HTTP Adapter', function() { done(error); }); }); + + test('droonga', function(done) { + var receiverCallback = {}; + var connection = utils.createStubbedBackendConnection(); + var application = express(); + application.use(express.bodyParser()); + httpAdapter.register(application, { + prefix: '', + connection: connection + }); + var searchQueries = { + source: 'table' + }; + utils.setupServer(application) + .next(function(newServer) { + server = newServer; + utils.post('/droonga/search', JSON.stringify({ queries: searchQueries })); + }) + .wait(0.1) + .next(function() { + assert.equal(1, connection.emitMessageCalledArguments.length); + var args = connection.emitMessageCalledArguments[0]; + assert.equal(args.type, 'search'); + + var expected = { + queries: searchQueries, + timeout: 1000, + type: 'droonga-search' + }; + assert.equalJSON(args.message, expected); + + done(); + }) + .error(function(error) { + done(error); + }); + }); }); }); -------------- next part -------------- HTML����������������������������... Download