Skip to content

Commit f2e524d

Browse files
committed
WIP: add query tests
There are some tests that have weird timing issues, and because of the polling nature of the original implementation, we never caught the issue. These should be resolved when able
1 parent 570a952 commit f2e524d

File tree

5 files changed

+102
-60
lines changed

5 files changed

+102
-60
lines changed

gulp/tasks/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function runBrowserUnitTests(dev) {
7373
// Don't include binary test files
7474
'./tests/**/binary/**/*.test.ts',
7575
],
76-
browsers: !!dev ? ['Chrome'] : config.karma.browsers
76+
browsers: !!dev ? ['ChromeHeadless'] : config.karma.browsers,
7777
});
7878
new karma.Server(karmaConfig, done).start();
7979
};

src/database/core/Repo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ export class Repo {
286286
* @param {number|string|null} newPriority
287287
* @param {?function(?Error, *=)} onComplete
288288
*/
289-
setWithPriority(path: Path, newVal: any, newPriority: number | string | null,
290-
onComplete: ((status: Error | null, errorReason?: string) => any) | null) {
289+
setWithPriority(path: Path, newVal: any,
290+
newPriority: number | string | null,
291+
onComplete: ((status: Error | null, errorReason?: string) => any) | null) {
291292
this.log_('set', {path: path.toString(), value: newVal, priority: newPriority});
292293

293294
// TODO: Optimize this behavior to either (a) store flag to skip resolving where possible and / or

tests/database/compound_write.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ describe('CompoundWrite Tests', function() {
215215
for (var i = 0; i < completeChildren.length; i++) {
216216
actual[completeChildren[i].name] = completeChildren[i].node;
217217
}
218-
expect(actual).to.equal(expected);
218+
expect(actual).to.deep.equal(expected);
219219
});
220220

221221
it('complete children return all children for root set', function() {
@@ -232,7 +232,7 @@ describe('CompoundWrite Tests', function() {
232232
for (var i = 0; i < completeChildren.length; i++) {
233233
actual[completeChildren[i].name] = completeChildren[i].node;
234234
}
235-
expect(actual).to.equal(expected);
235+
expect(actual).to.deep.equal(expected);
236236
});
237237

238238
it('empty merge has no shadowing write', function() {
@@ -369,14 +369,14 @@ describe('CompoundWrite Tests', function() {
369369
var compoundWrite = CompoundWrite.Empty;
370370
var path = new Path('child-1');
371371
compoundWrite = compoundWrite.addWrite(path, LEAF_NODE);
372-
expect(compoundWrite.apply(CHILDREN_NODE)).to.equal(CHILDREN_NODE.updateImmediateChild(path.getFront(), LEAF_NODE));
372+
expect(compoundWrite.apply(CHILDREN_NODE)).to.deep.equal(CHILDREN_NODE.updateImmediateChild(path.getFront(), LEAF_NODE));
373373
});
374374

375375
it('Updates existing child', function() {
376376
var compoundWrite = CompoundWrite.Empty;
377377
var path = new Path('child-1/foo');
378378
compoundWrite = compoundWrite.addWrite(path, LEAF_NODE);
379-
expect(compoundWrite.apply(CHILDREN_NODE)).to.equal(CHILDREN_NODE.updateChild(path, LEAF_NODE));
379+
expect(compoundWrite.apply(CHILDREN_NODE)).to.deep.equal(CHILDREN_NODE.updateChild(path, LEAF_NODE));
380380
});
381381

382382
it("Doesn't update priority on empty node.", function() {

tests/database/helpers.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,4 @@ export function pause(milliseconds: number) {
103103

104104
export function getPath(query: Query) {
105105
return query.toString().replace(TEST_PROJECT.databaseURL, '');
106-
}
107-
108-
export function runs() {}
109-
export function waitsFor() {}
106+
}

0 commit comments

Comments
 (0)