[tests][database] fixed broken 'root' tests - were incorrectly accessing a private property - switched to using 'path'
This commit is contained in:
parent
53acfe3584
commit
bec4e8c59c
|
@ -29,14 +29,14 @@ const testGroups = [
|
||||||
];
|
];
|
||||||
|
|
||||||
function registerTestSuite(testSuite) {
|
function registerTestSuite(testSuite) {
|
||||||
testSuite.beforeEach(async function () {
|
testSuite.beforeEach(async function beforeEach() {
|
||||||
this._databaseRef = testSuite.firebase.native.database().ref('tests/types');
|
this._databaseRef = testSuite.firebase.native.database().ref('tests/types');
|
||||||
|
|
||||||
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
||||||
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
||||||
});
|
});
|
||||||
|
|
||||||
testSuite.afterEach(async function () {
|
testSuite.afterEach(async function afterEach() {
|
||||||
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
await this._databaseRef.set(DatabaseContents.DEFAULT);
|
||||||
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
await this._databaseRef.parent.child('issues').set(DatabaseContents.ISSUES);
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,6 @@ function issueTests({ fdescribe, it, context, firebase }) {
|
||||||
// Setup
|
// Setup
|
||||||
|
|
||||||
const ref = firebase.native.database().ref('tests/issues/108');
|
const ref = firebase.native.database().ref('tests/issues/108');
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
return ref
|
return ref
|
||||||
|
|
|
@ -3,31 +3,21 @@ function rootTests({ fdescribe, it, context, firebase }) {
|
||||||
context('when called on a non-root reference', () => {
|
context('when called on a non-root reference', () => {
|
||||||
it('returns root ref', () => {
|
it('returns root ref', () => {
|
||||||
// Setup
|
// Setup
|
||||||
|
|
||||||
const rootRef = firebase.native.database().ref();
|
const rootRef = firebase.native.database().ref();
|
||||||
const nonRootRef = firebase.native.database().ref('tests/types/number');
|
const nonRootRef = firebase.native.database().ref('tests/types/number');
|
||||||
|
|
||||||
// Test
|
|
||||||
|
|
||||||
|
|
||||||
// Assertion
|
// Assertion
|
||||||
|
nonRootRef.root.path.should.eql(rootRef.path);
|
||||||
nonRootRef.root.query.should.eql(rootRef.query);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('when called on the root reference', () => {
|
context('when called on the root reference', () => {
|
||||||
it('returns root ref', () => {
|
it('returns root ref', () => {
|
||||||
// Setup
|
// Setup
|
||||||
|
|
||||||
const rootRef = firebase.native.database().ref();
|
const rootRef = firebase.native.database().ref();
|
||||||
|
|
||||||
// Test
|
|
||||||
|
|
||||||
|
|
||||||
// Assertion
|
// Assertion
|
||||||
|
rootRef.root.path.should.eql(rootRef.path);
|
||||||
rootRef.root.query.should.eql(rootRef.query);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue