We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I try to put a timestamp ( via firebase's TIMESTAMP or { '.sv : 'timestamp' } object, deep objects are not resolved to the time:
Test ` const Mock = require( 'firebase-mock' ) const { expect } = require( 'chai' )
let database = new Mock.MockFirebase() const firebase = Mock.MockFirebaseSdk( ( path ) => { return path ? database.child( path ) : database; } )
const time = 10 Mock.MockFirebase.setClock( () => time )
describe( 'Firebase Mock Timestamp', () => { beforeEach( () => { database = new Mock.MockFirebase( null, null ) database.autoFlush( 1 ) } )
it( 'should set all timestamps', async () => { const ts = { '.sv' : 'timestamp' } await firebase.initializeApp().database().ref().update( { t : ts, t2 : ts, 'd/e' : ts, 'x/y/z/aa' : ts, 'a/b/c' : ts } ) // await firebase.initializeApp().database().ref().update( { "t" : { '.sv' : 'timestamp' }, "a/b/c" : { '.sv' : 'timestamp' } }) const data = database.getData() console.log( JSON.stringify( data, null, 2 ) ) expect( data.t ).to.equal( 10 ) expect( data.t2 ).to.equal( 10 ) expect( data.d.e ).to.equal( 10 ) expect( data.x.y.z.aa ).to.equal( 10 ) expect( data.a.b.c ).to.equal( 10 ) } ) } )`
the resulting console log shows: { "a": { "b": { "c": { ".sv": "timestamp" } } }, "d": { "e": 10 }, "t": 10, "t2": 10, "x": { "y": { "z": { "aa": { ".sv": "timestamp" } } } } } Expected the a/b/c and x/y/z/aa should both be 10, and not the timestamp object
{ "a": { "b": { "c": { ".sv": "timestamp" } } }, "d": { "e": 10 }, "t": 10, "t2": 10, "x": { "y": { "z": { "aa": { ".sv": "timestamp" } } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I try to put a timestamp ( via firebase's TIMESTAMP or { '.sv : 'timestamp' } object, deep objects are not resolved to the time:
Test
`
const Mock = require( 'firebase-mock' )
const { expect } = require( 'chai' )
let database = new Mock.MockFirebase()
const firebase = Mock.MockFirebaseSdk( ( path ) => {
return path ? database.child( path ) : database;
} )
const time = 10
Mock.MockFirebase.setClock( () => time )
describe( 'Firebase Mock Timestamp', () => {
beforeEach( () => {
database = new Mock.MockFirebase( null, null )
database.autoFlush( 1 )
} )
it( 'should set all timestamps', async () => {
const ts = { '.sv' : 'timestamp' }
await firebase.initializeApp().database().ref().update( { t : ts, t2 : ts, 'd/e' : ts, 'x/y/z/aa' : ts, 'a/b/c' : ts } )
// await firebase.initializeApp().database().ref().update( { "t" : { '.sv' : 'timestamp' }, "a/b/c" : { '.sv' : 'timestamp' } })
const data = database.getData()
console.log( JSON.stringify( data, null, 2 ) )
expect( data.t ).to.equal( 10 )
expect( data.t2 ).to.equal( 10 )
expect( data.d.e ).to.equal( 10 )
expect( data.x.y.z.aa ).to.equal( 10 )
expect( data.a.b.c ).to.equal( 10 )
} )
} )`
the resulting console log shows:
{ "a": { "b": { "c": { ".sv": "timestamp" } } }, "d": { "e": 10 }, "t": 10, "t2": 10, "x": { "y": { "z": { "aa": { ".sv": "timestamp" } } } } }
Expected
the a/b/c and x/y/z/aa should both be 10, and not the timestamp object
The text was updated successfully, but these errors were encountered: