Skip to content

Commit

Permalink
#2027 sqlCache retains data (and other properties), possible memory l…
Browse files Browse the repository at this point in the history
…eak #2027

- Add assertions
  • Loading branch information
paulrutter committed Jan 9, 2025
1 parent 15d706b commit c77796e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/test2027.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ describe('Test 2007 - SQL cache', function () {
assert.deepEqual(alasql.databases["test"].sqlCache["-169125189"].query.data, []);
assert.equal(res.length, 3);

// Delete all rows
alasql('DELETE FROM osoby');

// Assert that the cache is still empty for "data"
assert.deepEqual(alasql.databases["test"].sqlCache["-169125189"].query.data, []);

// Insert more rows
alasql('INSERT INTO osoby VALUES (4, "Jack"), (5, "Paul")');

Expand All @@ -30,6 +36,6 @@ describe('Test 2007 - SQL cache', function () {

// Cache should still be empty for "data"
assert.deepEqual(alasql.databases["test"].sqlCache["-169125189"].query.data, []);
assert.equal(res2.length, 5);
assert.equal(res2.length, 2);
});
});

0 comments on commit c77796e

Please sign in to comment.