Navigation Menu

Skip to content

Commit

Permalink
Add tests for auto detection about index field types from the database
Browse files Browse the repository at this point in the history
  • Loading branch information
piro committed Aug 1, 2012
1 parent 35d6f0a commit 5029cde
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/database-index-field.test.js
Expand Up @@ -136,5 +136,38 @@ suite('domain', function() {
});
});

suite('getting data from database', function() {
var temporaryDatabase;
var context;
var domain;

setup(function() {
temporaryDatabase = utils.createTemporaryDatabase();
context = temporaryDatabase.get();
utils.loadDumpFile(context, __dirname + '/fixture/companies/ddl.grn');
domain = new Domain('companies', context);
});

teardown(function() {
domain = undefined;
temporaryDatabase.teardown();
temporaryDatabase = undefined;
});

test('type detection (text)', function() {
var field = new IndexField('name', domain);
assert.equal(field.type, 'text');
});

test('type detection (uint)', function() {
var field = new IndexField('age', domain);
assert.equal(field.type, 'uint');
});

test('type detection (literal)', function() {
var field = new IndexField('product', domain);
assert.equal(field.type, 'literal');
});
});
});
});

0 comments on commit 5029cde

Please sign in to comment.