Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/memory-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -294,6 +304,7 @@ module.exports = function (opts) {
, count: count
, idProperty: options.idProperty
, createOrUpdate: createOrUpdate
, idType: idType
})

return self
Expand Down
1 change: 1 addition & 0 deletions test/engine.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
14 changes: 14 additions & 0 deletions test/id-type.js
Original file line number Diff line number Diff line change
@@ -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()
})
})
})

}