From c1abfcf0028eb0eb64176388b2e9b2e9cd77414c Mon Sep 17 00:00:00 2001 From: Salakar Date: Thu, 12 Apr 2018 18:13:40 +0100 Subject: [PATCH] [tests] misc --- bridge/README.md | 26 +++----------------- bridge/app.js | 1 + bridge/e2e/firestore/documentSnapshot.e2e.js | 22 +++++++++++++++++ 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/bridge/README.md b/bridge/README.md index 16872d4b..de3c0ede 100755 --- a/bridge/README.md +++ b/bridge/README.md @@ -14,27 +14,7 @@ * Run `npm install`. -## To test Release build of your app - -### Step 2: Build - -* Build the demo project - -```sh -detox build --configuration ios.sim.release -``` - -### Step 3: Test - -* Run tests on the demo project - -```sh -detox test --configuration ios.sim.release -``` - -This action will open a new simulator and run the tests on it. - -## To test Debug build of your app +## To test build of your app ### Step 2: Build @@ -84,7 +64,9 @@ Error: Failed to parse properties from /Users/mike/.android/avd/Actually_THIS_on #### Running specific tests -Add a `--grep` to e2e/mocha.opts file, e.g. `--grep auth` for all tests that have auth in the file path or tests descriptions. +Mocha supports the `.only` syntax, e.g. instead of `describe(...) || it(...)` you can use `describe.only(...) || it.only(...)` to only run that specific context or test. + +Another way to do this is via adding a `--grep` option to e2e/mocha.opts file, e.g. `--grep auth` for all tests that have auth in the file path or tests descriptions. #### Running Node debugger diff --git a/bridge/app.js b/bridge/app.js index f88ac5e0..b959bfab 100755 --- a/bridge/app.js +++ b/bridge/app.js @@ -25,6 +25,7 @@ class Root extends Component { bridge.setBridgeProperty('root', this); bridge.setBridgeProperty('module', firebase); + bridge.setBridgeProperty('require', require); } render() { diff --git a/bridge/e2e/firestore/documentSnapshot.e2e.js b/bridge/e2e/firestore/documentSnapshot.e2e.js index 57799da4..3f7c7d73 100644 --- a/bridge/e2e/firestore/documentSnapshot.e2e.js +++ b/bridge/e2e/firestore/documentSnapshot.e2e.js @@ -4,6 +4,28 @@ describe('firestore()', () => { await TestHelpers.firestore.resetTestCollectionDoc(); }); + describe('id', () => { + it('returns a string document id', async () => { + const { testCollectionDoc, COL_DOC_1_ID } = TestHelpers.firestore; + const snapshot = await testCollectionDoc().get(); + snapshot.id.should.be.a.String(); + snapshot.id.should.equal(COL_DOC_1_ID); + }); + }); + + describe.only('ref', () => { + it('returns a DocumentReference', async () => { + const { testCollectionDoc } = TestHelpers.firestore; + const snapshot = await testCollectionDoc().get(); + // console.dir(bridge.context.require.getModules()); + // snapshot.ref.should.be.an.instanceOf( + // bridge.require( + // 'react-native-firebase/dist/modules/firestore/DocumentReference.js' + // ) + // ); + }); + }); + describe('get()', () => { it('using a dot notated path string', async () => { const { testCollectionDoc } = TestHelpers.firestore;