From b12d9b29d04b078b659f8f7a23d9ceecdb203a0a Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Mon, 23 Oct 2017 18:01:42 +0100 Subject: [PATCH] [database][tests] Add tests for #489 --- .../tests/database/ref/issueSpecificTests.js | 24 +++++++++++++++++++ tests/src/tests/support/DatabaseContents.js | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/tests/src/tests/database/ref/issueSpecificTests.js b/tests/src/tests/database/ref/issueSpecificTests.js index 816774de..58cd5ce8 100644 --- a/tests/src/tests/database/ref/issueSpecificTests.js +++ b/tests/src/tests/database/ref/issueSpecificTests.js @@ -84,6 +84,30 @@ function issueTests({ describe, it, context, firebase }) { }); }); + describe('issue_489', () => { + context('long numbers should', () => { + it('return as longs', async () => { + // Setup + + const long1Ref = firebase.native.database().ref('tests/issues/489/long1'); + const long2Ref = firebase.native.database().ref('tests/issues/489/long2'); + const long2 = 1234567890123456; + + // Test + + let snapshot = await long1Ref.once('value'); + snapshot.val().should.eql(DatabaseContents.ISSUES[489].long1); + + + await long2Ref.set(long2); + snapshot = await long2Ref.once('value'); + snapshot.val().should.eql(long2); + + return Promise.resolve(); + }); + }); + }); + describe('issue_521', () => { context('orderByChild (numerical field) and limitToLast', () => { it('once() returns correct results', async () => { diff --git a/tests/src/tests/support/DatabaseContents.js b/tests/src/tests/support/DatabaseContents.js index bace7f99..5d7180e2 100644 --- a/tests/src/tests/support/DatabaseContents.js +++ b/tests/src/tests/support/DatabaseContents.js @@ -92,6 +92,10 @@ export default { }, }, + 489: { + long1: 1508777379000, + }, + // https://github.com/invertase/react-native-firebase/issues/521 521: { key1: {