From 380e1ebc95b93ff0fce84c5e75092c018ed52422 Mon Sep 17 00:00:00 2001 From: "Kenneth G. Franqueiro" Date: Fri, 13 Feb 2015 23:58:20 -0500 Subject: [PATCH] Add Trackable unit tests for preservation of totalLength --- tests/Trackable.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Trackable.js b/tests/Trackable.js index 68fe64f..8b6fa49 100644 --- a/tests/Trackable.js +++ b/tests/Trackable.js @@ -596,6 +596,22 @@ define([ lastEvent = null; store.put({ id: 12, name: 'item-12', order: 12 }); assert.isNull(lastEvent); + }, + + 'fetch preserves totalLength API': function () { + var store = createStore({ data: [] }, Memory); + var trackedCollection = store.track(); + var results = trackedCollection.fetch(); + + assert.isDefined(results.totalLength, 'totalLength should be defined on fetch results'); + }, + + 'fetchRange preserves totalLength API': function () { + var store = createStore({ data: [] }, Memory); + var trackedCollection = store.track(); + var results = trackedCollection.fetchRange({ start: 0, end: 10 }); + + assert.isDefined(results.totalLength, 'totalLength should be defined on fetch results'); } }; }