|
@ -130,3 +130,29 @@ test('Max out score repo cache', () => { |
|
|
|
|
|
|
|
|
expect(testRepo.scoreCache.length).toEqual(100); |
|
|
expect(testRepo.scoreCache.length).toEqual(100); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('Build 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.getHighScores(); |
|
|
|
|
|
|
|
|
|
|
|
expect(queried.length).toEqual(100); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('Build max score cache', () => { |
|
|
|
|
|
let mockRealm = new MockRealm({schemaVersion: 0}); |
|
|
|
|
|
let testRepo = new ScoreRepo(mockRealm); |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 200; ++i) { |
|
|
|
|
|
testRepo.createScore({value: i, username: 'user'}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let queried = testRepo.getHighScores(); |
|
|
|
|
|
|
|
|
|
|
|
expect(queried.length).toEqual(100); |
|
|
|
|
|
}) |