diff --git a/lib/memory-engine.js b/lib/memory-engine.js index 2d1479a..e44afd0 100644 --- a/lib/memory-engine.js +++ b/lib/memory-engine.js @@ -283,6 +283,16 @@ module.exports = function (opts) { }) } + /** + * Casts an id to the type required by the database + * + * @param {String} the value to cast + * @api public + */ + function idType(value) { + return value + } + extend(self , { create: create , read: read @@ -294,6 +304,7 @@ module.exports = function (opts) { , count: count , idProperty: options.idProperty , createOrUpdate: createOrUpdate + , idType: idType }) return self diff --git a/test/engine.tests.js b/test/engine.tests.js index 0f6a785..4ef15d3 100644 --- a/test/engine.tests.js +++ b/test/engine.tests.js @@ -28,6 +28,7 @@ module.exports = function (idProperty, getEngine, beforeCallback, afterCallback) , './count' , './create-or-update' , './streaming' + , './id-type' ].map(function(testFile) { require(testFile)(idProperty, getEngine) }) diff --git a/test/id-type.js b/test/id-type.js new file mode 100644 index 0000000..44a5f34 --- /dev/null +++ b/test/id-type.js @@ -0,0 +1,14 @@ +var assert = require('assert') + +module.exports = function(idProperty, getEngine) { + + describe('#idType()', function () { + it('should return a function', function (done) { + getEngine(function (error, engine) { + assert.equal(typeof engine.idType, 'function') + done() + }) + }) + }) + +}