Navigation Menu

Skip to content

Commit

Permalink
Add test for updateSynonymsSync about replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 9, 2012
1 parent 381373d commit 69639ef
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion test/database-domain.test.js
Expand Up @@ -302,7 +302,7 @@ suite('database', function() {
assert.equal(dump, expectedDump);
});

test('updateSynonymsSync', function() {
test('updateSynonymsSync, initialize', function() {
var domain = new Domain('companies', context);
assert.isFalse(domain.hasSynonymsTableSync());

Expand All @@ -329,6 +329,32 @@ suite('database', function() {
assert.equal(dumpExpected, dumpActual);
});

test('updateSynonymsSync, replace', function() {
var domain = new Domain('companies', context);
domain.updateSynonymsSync({
tokio: ['tokyo'],
dekkaido: 'hokkaido'
});
domain.updateSynonymsSync({
tokio: ['tonkin']
});

var dumpExpected =
'table_create ' + domain.synonymsTableName + ' ' +
'TABLE_HASH_KEY|KEY_NORMALIZE ShortText\n' +
'column_create ' + domain.synonymsTableName + ' ' +
'synonyms COLUMN_VECTOR ShortText\n' +
'load --table ' + domain.synonymsTableName + '\n' +
'[\n' +
'["_key","synonyms"],\n' +
'["tokio",["tonkin"]]\n' +
']';
var dumpActual = context.commandSync('dump', {
tables: domain.synonymsTableName
});
assert.equal(dumpExpected, dumpActual);
});

test('getSynonymsSync', function() {
var domain = new Domain('companies', context);
domain.updateSynonymsSync({
Expand Down

0 comments on commit 69639ef

Please sign in to comment.