Skip to content

Commit 858d6a1

Browse files
committed
Replaced count check
1 parent 8e67f2d commit 858d6a1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/database/test/exp/integration.test.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ describe('Database@exp Tests', () => {
121121
unsubscribe();
122122
});
123123

124-
it('can properly handle unknown deep merges', async () => {
124+
it.only('can properly handle unknown deep merges', async () => {
125125
const database = getDatabase(defaultApp);
126126
const root = ref(database, 'testing');
127-
await remove(root);
127+
await set(root, {});
128128

129129
const q = query(root, orderByChild('testIndex'), limitToFirst(2));
130130

@@ -146,9 +146,8 @@ describe('Database@exp Tests', () => {
146146
action: 'test'
147147
}
148148
});
149-
const ec = EventAccumulatorFactory.waitsForExactCount(1);
149+
const ec = EventAccumulatorFactory.waitsForExactCount(2);
150150
const onChildAddedCb = onChildAdded(q, snap => {
151-
const value = snap.val();
152151
ec.addEvent(snap);
153152
});
154153
const onValueCb = onValue(i1, () => {
@@ -157,11 +156,13 @@ describe('Database@exp Tests', () => {
157156
await update(i1, {
158157
timestamp: `${Date.now()}|1`
159158
});
160-
const [result] = await ec.promise;
161-
const value = result.val();
162-
expect(value).to.haveOwnProperty('timestamp');
163-
expect(value).to.haveOwnProperty('action');
164-
expect(value).to.haveOwnProperty('testIndex');
159+
const results = await ec.promise;
160+
results.forEach(result => {
161+
const value = result.val();
162+
expect(value).to.haveOwnProperty('timestamp');
163+
expect(value).to.haveOwnProperty('action');
164+
expect(value).to.haveOwnProperty('testIndex');
165+
});
165166
onChildAddedCb();
166167
onValueCb();
167168
});

packages/database/test/helpers/EventAccumulator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
export const EventAccumulatorFactory = {
18+
export const EventAccumulatorFactory = { // TODO: Convert to use generics to take the most advantage of types.
1919
waitsForCount: maxCount => {
2020
// Note: This should be used sparingly as it can result in more events being raised than expected
2121
let count = 0;

0 commit comments

Comments
 (0)