@@ -20,13 +20,19 @@ import { initializeApp, deleteApp } from '@firebase/app-exp';
20
20
import { expect } from 'chai' ;
21
21
import { DATABASE_ADDRESS , DATABASE_URL } from '../helpers/util' ;
22
22
23
- import { getDatabase } from '../../exp/index' ;
23
+ import {
24
+ getDatabase ,
25
+ goOffline ,
26
+ goOnline ,
27
+ ref ,
28
+ refFromURL
29
+ } from '../../exp/index' ;
24
30
25
31
export function createTestApp ( ) {
26
32
return initializeApp ( { databaseURL : DATABASE_URL } ) ;
27
33
}
28
34
29
- describe ( 'Database Tests' , ( ) => {
35
+ describe . skip ( 'Database Tests' , ( ) => {
30
36
let defaultApp ;
31
37
32
38
beforeEach ( ( ) => {
@@ -48,7 +54,7 @@ describe('Database Tests', () => {
48
54
const db = getDatabase ( defaultApp , 'http://foo.bar.com' ) ;
49
55
expect ( db ) . to . be . ok ;
50
56
// The URL is assumed to be secure if no port is specified.
51
- expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://foo.bar.com/' ) ;
57
+ expect ( ref ( db ) . toString ( ) ) . to . equal ( 'https://foo.bar.com/' ) ;
52
58
} ) ;
53
59
54
60
it ( 'Can get app' , ( ) => {
@@ -58,33 +64,33 @@ describe('Database Tests', () => {
58
64
59
65
it ( 'Can set and ge tref' , async ( ) => {
60
66
const db = getDatabase ( defaultApp ) ;
61
- await db . ref ( 'foo/bar' ) . set ( 'foobar' ) ;
62
- const snap = await db . ref ( 'foo/bar' ) . get ( ) ;
67
+ await ref ( db , 'foo/bar' ) . set ( 'foobar' ) ;
68
+ const snap = await ref ( db , 'foo/bar' ) . get ( ) ;
63
69
expect ( snap . val ( ) ) . to . equal ( 'foobar' ) ;
64
70
} ) ;
65
71
66
72
it ( 'Can get refFromUrl' , async ( ) => {
67
73
const db = getDatabase ( defaultApp ) ;
68
- await db . refFromURL ( `${ DATABASE_ADDRESS } /foo/bar` ) . get ( ) ;
74
+ await refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) . get ( ) ;
69
75
} ) ;
70
76
71
77
it ( 'Can goOffline/goOnline' , async ( ) => {
72
78
const db = getDatabase ( defaultApp ) ;
73
- db . goOffline ( ) ;
79
+ goOffline ( db ) ;
74
80
try {
75
- await db . ref ( 'foo/bar' ) . get ( ) ;
81
+ await ref ( db , 'foo/bar' ) . get ( ) ;
76
82
expect . fail ( 'Should have failed since we are offline' ) ;
77
83
} catch ( e ) {
78
84
expect ( e . message ) . to . equal ( 'Error: Client is offline.' ) ;
79
85
}
80
- db . goOnline ( ) ;
81
- await db . ref ( 'foo/bar' ) . get ( ) ;
86
+ goOnline ( db ) ;
87
+ await ref ( db , 'foo/bar' ) . get ( ) ;
82
88
} ) ;
83
89
84
90
it ( 'Can delete app' , async ( ) => {
85
91
const db = getDatabase ( defaultApp ) ;
86
92
await deleteApp ( defaultApp ) ;
87
- expect ( ( ) => db . ref ( ) ) . to . throw ( 'Cannot call ref on a deleted database.' ) ;
93
+ expect ( ( ) => ref ( db ) ) . to . throw ( 'Cannot call ref on a deleted database.' ) ;
88
94
defaultApp = undefined ;
89
95
} ) ;
90
96
} ) ;
0 commit comments