File tree Expand file tree Collapse file tree 6 files changed +526
-290
lines changed Expand file tree Collapse file tree 6 files changed +526
-290
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import firebase from "../../src/app";
3
3
import {
4
4
TEST_PROJECT ,
5
5
patchFakeAuthFunctions ,
6
- } from "./helpers" ;
6
+ } from "./helpers/util " ;
7
7
import "../../src/database" ;
8
8
9
9
describe ( 'Database Tests' , function ( ) {
Original file line number Diff line number Diff line change 1
1
import { expect } from "chai" ;
2
2
import { nodeFromJSON } from "../../src/database/core/snap/nodeFromJSON" ;
3
3
import { PRIORITY_INDEX } from "../../src/database/core/snap/indexes/PriorityIndex" ;
4
- import { getRandomNode } from "./helpers" ;
4
+ import { getRandomNode } from "./helpers/util " ;
5
5
import { DataSnapshot } from "../../src/database/api/DataSnapshot" ;
6
6
import { Reference } from "../../src/database/api/Reference" ;
7
7
Original file line number Diff line number Diff line change
1
+ export class EventAccumulator {
2
+ public eventData = [ ] ;
3
+ public promise ;
4
+ public resolve ;
5
+ public reject ;
6
+ constructor ( private expectedEvents : number ) {
7
+ if ( ! this . expectedEvents ) throw new Error ( 'EventAccumulator:You must pass a number of expected events to the constructor' ) ;
8
+ this . promise = new Promise ( ( resolve , reject ) => {
9
+ this . resolve = resolve ;
10
+ this . reject = reject ;
11
+ } ) ;
12
+ }
13
+ addEvent ( eventData ?: any ) {
14
+ this . eventData = [
15
+ ...this . eventData ,
16
+ eventData
17
+ ] ;
18
+ if ( this . eventData . length >= this . expectedEvents ) {
19
+ this . resolve ( this . eventData ) ;
20
+ }
21
+ }
22
+ reset ( expectedEvents ?: number ) {
23
+ this . expectedEvents = expectedEvents || this . expectedEvents ;
24
+ this . eventData = [ ] ;
25
+ this . promise = new Promise ( ( resolve , reject ) => {
26
+ this . resolve = resolve ;
27
+ this . reject = reject ;
28
+ } ) ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change 1
- import firebase from "../../src/app" ;
2
- import '../../src/database' ;
3
- import { Reference } from "../../src/database/api/Reference" ;
4
- import { Query } from "../../src/database/api/Query" ;
1
+ import firebase from "../../../ src/app" ;
2
+ import '../../../ src/database' ;
3
+ import { Reference } from "../../../ src/database/api/Reference" ;
4
+ import { Query } from "../../../ src/database/api/Query" ;
5
5
import { expect } from "chai" ;
6
6
7
- export const TEST_PROJECT = require ( '../config/project.json' ) ;
7
+ export const TEST_PROJECT = require ( '../../ config/project.json' ) ;
8
8
9
9
var qs = { } ;
10
10
if ( 'location' in this ) {
You can’t perform that action at this time.
0 commit comments