Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4a0df56
refactor(database): add typescript implementation
jshcrowthe Jun 16, 2017
dcf2f5c
refactor(database): update build process to include database.ts
jshcrowthe Jun 16, 2017
7e609d6
refactor(*): refactor environment builds to be based on separate .ts …
jshcrowthe Jun 16, 2017
e72bfbe
WIP: patch database code in nodeJS
jshcrowthe Jun 16, 2017
2f6a406
refactor(database): classes for typescript database implementation (#55)
jsayol Jun 17, 2017
19519ac
WIP: add the /tests/config dir to the .gitignore
jshcrowthe Jun 19, 2017
2758ca7
WIP: add test harness
jshcrowthe Jun 19, 2017
7f78f89
WIP: add query tests
jshcrowthe Jun 19, 2017
b12a61f
WIP: add database.test.ts
jshcrowthe Jun 19, 2017
a046261
WIP: add node.test.ts
jshcrowthe Jun 19, 2017
622fed8
WIP: add sortedmap.test.ts
jshcrowthe Jun 19, 2017
d35b183
WIP: add datasnapshot.test.ts
jshcrowthe Jun 19, 2017
c81583d
WIP: add sparsesnapshottree.test.ts
jshcrowthe Jun 19, 2017
f4fc618
refactor(database): refactor query.test.ts to better preserve origina…
jshcrowthe Jun 20, 2017
342d527
WIP: add crawler_support.test.ts
jshcrowthe Jun 20, 2017
c51999a
WIP: refactor EventAccumulator.ts for data.test.ts
jshcrowthe Jun 21, 2017
c0eba9c
WIP: fix issue with query.test.ts
jshcrowthe Jun 22, 2017
e290f67
WIP: add connection.test.ts
jshcrowthe Jun 22, 2017
c0af997
WIP: add info.test.ts
jshcrowthe Jun 22, 2017
1223678
WIP: add order_by.test.ts
jshcrowthe Jun 22, 2017
9e08172
WIP: fix several code signature problems, add test files
jshcrowthe Jun 22, 2017
379a263
WIP: add transaction.test.ts
jshcrowthe Jun 26, 2017
3193651
WIP: working on the broken npm test command
jshcrowthe Jun 27, 2017
d5f99d8
WIP: working on fixes
jshcrowthe Jun 27, 2017
58f8bff
WIP: remove logging
jshcrowthe Jun 27, 2017
869b9a5
WIP: fix node tests
jshcrowthe Jun 27, 2017
ebe491c
fix(*): fixing test files and CI integration
jshcrowthe Jun 28, 2017
2b1efa4
WIP: tEMP: Allow branch builds
jshcrowthe Jun 28, 2017
c40a189
WIP: escape string
jshcrowthe Jun 28, 2017
d78d6c4
refactor(CI): use ChromeHeadless launcher
jshcrowthe Jun 28, 2017
2939025
Merge branch 'ts-database/final' into ts-database/migrate-test-harness
jshcrowthe Jun 28, 2017
d214ba0
WIP: fixes from review.
jshcrowthe Jun 29, 2017
dc5c374
WIP: skip flakey test
jshcrowthe Jun 29, 2017
71ff51c
WIP: remove unneeded debugger statement
jshcrowthe Jun 29, 2017
2531901
WIP: fixing nits
jshcrowthe Jul 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ declare module './app/firebase_app' {
interface FirebaseNamespace {
database?: {
(app?: FirebaseApp): Database,
Reference,
Query,
Database,
enableLogging,
INTERNAL,
Query,
Reference,
ServerValue,
}
}
}
Expand Down
32 changes: 29 additions & 3 deletions tests/database/helpers/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ function rawPath(firebaseRef) {
* @return {{waiter: waiter, watchesInitializedWaiter: watchesInitializedWaiter, unregister: unregister, addExpectedEvents: addExpectedEvents}}
*/
export function eventTestHelper(pathAndEvents, helperName?) {
let resolve, reject;
let promise = new Promise((pResolve, pReject) => {
resolve = pResolve;
reject = pReject;
});
let initResolve, initReject;
const initPromise = new Promise((pResolve, pReject) => {
initResolve = pResolve;
initReject = pReject;
});
var expectedPathAndEvents = [];
var actualPathAndEvents = [];
var pathEventListeners = {};
Expand All @@ -58,6 +68,14 @@ export function eventTestHelper(pathAndEvents, helperName?) {
// test framework is calling the waiter... makes for easier debugging.
waiter();
}

// We want to trigger the promise resolution if valid, so try to call waiter as events
// are coming back.
try {
if (waiter()) {
resolve();
}
} catch(e) {}
};
};

Expand Down Expand Up @@ -152,6 +170,11 @@ export function eventTestHelper(pathAndEvents, helperName?) {
pathEventListeners[path.toString()].unlisten = listenOnPath(path);
}
}

promise = new Promise((pResolve, pReject) => {
resolve = pResolve;
reject = pReject;
});
};

addExpectedEvents(pathAndEvents);
Expand All @@ -166,6 +189,7 @@ export function eventTestHelper(pathAndEvents, helperName?) {
actualPathAndEvents.splice(actualPathAndEvents.length - initializationEvents, initializationEvents);
initializationEvents = 0;

initResolve();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is more of a "resolveInit()", since initX sounds like it would initialize X.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return true;
};

Expand All @@ -179,9 +203,11 @@ export function eventTestHelper(pathAndEvents, helperName?) {

eventCleanupHandlers.push(unregister);
return {
waiter: waiter,
watchesInitializedWaiter: watchesInitializedWaiter,
unregister: unregister,
promise,
initPromise,
waiter,
watchesInitializedWaiter,
unregister,

addExpectedEvents: function(moreEvents) {
addExpectedEvents(moreEvents);
Expand Down
1 change: 1 addition & 0 deletions tests/database/info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare var TEST_ALT_NAMESPACE;
declare var TEST_NAMESPACE;

describe(".info Tests", function () {
this.timeout(3000);
it("Can get a reference to .info nodes.", function() {
var f = (getRootNode() as Reference);
expect(getPath(f.child('.info'))).to.equal('/.info');
Expand Down
Loading