@@ -37,12 +37,23 @@ describe('database().ref().keepSynced()', function () {
3737 }
3838 } ) ;
3939
40- it ( 'toggles keepSynced on and off without throwing' , async function ( ) {
40+ it ( 'toggles keepSynced on and off without throwing on supported platforms ' , async function ( ) {
4141 if ( Platform . other ) return ;
4242 const ref = firebase . database ( ) . ref ( 'noop' ) . orderByValue ( ) ;
4343 await ref . keepSynced ( true ) ;
4444 await ref . keepSynced ( false ) ;
4545 } ) ;
46+
47+ it ( 'keepSynced throws on unsupported platforms' , async function ( ) {
48+ if ( ! Platform . other ) return ;
49+ try {
50+ await firebase . database ( ) . ref ( 'noop' ) . orderByValue ( ) . keepSynced ( true ) ;
51+ throw new Error ( 'did not throw' ) ;
52+ } catch ( error ) {
53+ error . code . should . containEql ( 'unsupported' ) ;
54+ error . message . should . containEql ( 'This operation is not supported on this environment.' ) ;
55+ }
56+ } ) ;
4657 } ) ;
4758
4859 describe ( 'modular' , function ( ) {
@@ -58,13 +69,26 @@ describe('database().ref().keepSynced()', function () {
5869 }
5970 } ) ;
6071
61- it ( 'toggles keepSynced on and off without throwing' , async function ( ) {
72+ it ( 'toggles keepSynced on and off without throwing on supported platforms ' , async function ( ) {
6273 if ( Platform . other ) return ;
6374 const { getDatabase, ref, orderByValue, query, keepSynced } = databaseModular ;
6475
6576 const dbRef = query ( ref ( getDatabase ( ) , 'noop' ) , orderByValue ( ) ) ;
6677 await keepSynced ( dbRef , true ) ;
6778 await keepSynced ( dbRef , false ) ;
6879 } ) ;
80+
81+ it ( 'keepSynced throws on unsupported platforms' , async function ( ) {
82+ if ( ! Platform . other ) return ;
83+ const { getDatabase, ref, orderByValue, query, keepSynced } = databaseModular ;
84+
85+ try {
86+ await keepSynced ( query ( ref ( getDatabase ( ) , 'noop' ) , orderByValue ( ) ) , true ) ;
87+ throw new Error ( 'did not throw' ) ;
88+ } catch ( error ) {
89+ error . code . should . containEql ( 'unsupported' ) ;
90+ error . message . should . containEql ( 'This operation is not supported on this environment.' ) ;
91+ }
92+ } ) ;
6993 } ) ;
7094} ) ;
0 commit comments