Browse Source

score cache unit test

pull/11/head
Tim Glasgow 2 years ago
parent
commit
e078624851
  1. 13
      squarenotsquare/__tests__/Repo-test.js

13
squarenotsquare/__tests__/Repo-test.js

@ -154,5 +154,18 @@ test('Build max score cache', () => {
let queried = testRepo.getHighScores(); let queried = testRepo.getHighScores();
expect(queried.length).toEqual(100);
})
test('Query score cache', () => {
let mockRealm = new MockRealm({schemaVersion: 0});
let testRepo = new ScoreRepo(mockRealm);
for (let i = 0; i < 100; ++i) {
testRepo.createScore({value: i, username: 'user'})
}
let queried = testRepo.getCachedScores();
expect(queried.length).toEqual(100); expect(queried.length).toEqual(100);
}) })
Loading…
Cancel
Save