Navigation Menu

Skip to content

Commit

Permalink
test: add a test for no _key case
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 25, 2014
1 parent e6289f3 commit 9ecce5a
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions test/adapter/api/groonga/load.test.js
Expand Up @@ -123,6 +123,36 @@ suite('adapter/api/groonga: load', function() {
});

suite('object style', function() {
test('no _key', function(done) {
var requestBody;
backend.reserveResponse(function(requestPacket) {
requestBody = requestPacket[2].body;
return utils.createReplyPacket(requestPacket, successMessage);
});
var body = [
{
title: 'Droonga',
content: 'Droonga is fun!'
}
]
utils.post('/d/load?table=Memos', JSON.stringify(body))
.next(function(response) {
try {
assert.deepEqual(requestBody,
{
table: 'Memos',
values: {
title: 'Droonga',
content: 'Droonga is fun!'
}
});
done();
} catch (error) {
done(error);
}
});
});

test('with columns', function(done) {
var requestBody;
backend.reserveResponse(function(requestPacket) {
Expand All @@ -141,13 +171,13 @@ suite('adapter/api/groonga: load', function() {
try {
assert.deepEqual(requestBody,
{
table: 'Users',
key: 'alice',
values: {
name: 'Alice',
age: 20
}
});
table: 'Users',
key: 'alice',
values: {
name: 'Alice',
age: 20
}
});
done();
} catch (error) {
done(error);
Expand Down

0 comments on commit 9ecce5a

Please sign in to comment.