Skip to content

Commit

Permalink
update source_cache tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvoll committed Feb 4, 2017
1 parent 4eb9261 commit 545a88d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/js/source/source_cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,30 @@ test('SourceCache#clearTiles', (t) => {
t.end();
});

test('SourceCache#unloadTileFromCache', (t) => {
t.test('does not unload a tile present in _tiles', (t) => {
const coord = new TileCoord(0, 0, 0);
let unload = 0;

const sourceCache = createSourceCache({
unloadTile: function(tile) {
t.deepEqual(tile.coord, coord);
unload++;
}
});
sourceCache.onAdd();

sourceCache.addTile(coord);
sourceCache.unloadTileFromCache({ coord });

t.equal(unload, 0);

t.end();
});

t.end();
});

test('SourceCache#tilesIn', (t) => {
t.test('graceful response before source loaded', (t) => {
const sourceCache = createSourceCache({ noLoad: true });
Expand Down Expand Up @@ -871,7 +895,7 @@ test('SourceCache#findLoadedParent', (t) => {
t.equal(sourceCache.findLoadedParent(new TileCoord(2, 3, 3), 0, retain), undefined);
t.equal(sourceCache.findLoadedParent(new TileCoord(2, 0, 0), 0, retain), tile);
t.deepEqual(retain, expectedRetain);
t.equal(sourceCache._cache.order.length, 0);
t.equal(sourceCache._cache.order.length, 1);

t.end();
});
Expand Down

0 comments on commit 545a88d

Please sign in to comment.