Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

firestore-jest-mock

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firestore-jest-mock - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0

__tests__/full-setup-library-firestore.test.js

1

index.d.ts

@@ -5,1 +5,2 @@ export { FakeFirestore } from './mocks/firestore';

export { mockGoogleCloudFirestore } from './mocks/googleCloudFirestore';
export { mockReactNativeFirestore } from './mocks/reactNativeFirebaseFirestore';

@@ -5,2 +5,3 @@ const { FakeFirestore } = require('./mocks/firestore');

const { mockGoogleCloudFirestore } = require('./mocks/googleCloudFirestore');
const { mockReactNativeFirestore } = require('./mocks/reactNativeFirebaseFirestore');

@@ -10,4 +11,5 @@ module.exports = {

mockFirebase,
mockReactNativeFirestore,
FakeFirestore,
FakeAuth,
};

3

package.json
{
"name": "firestore-jest-mock",
"version": "0.18.0",
"version": "0.19.0",
"description": "Jest helper for mocking Google Cloud Firestore",

@@ -39,2 +39,3 @@ "author": "",

"@babel/preset-env": "^7.5.5",
"@react-native-firebase/firestore": "^15.1.1",
"@types/jest": "^26.0.20",

@@ -41,0 +42,0 @@ "@typescript-eslint/eslint-plugin": "^4.17.0",

@@ -25,2 +25,3 @@ # Mock Firestore

- [`@google-cloud/firestore` compatibility](#google-cloudfirestore-compatibility)
- [`@react-native-firebase/firestore` compatibility](#react-native-firebasefirestore-compatibility)
- [Subcollections](#subcollections)

@@ -31,5 +32,5 @@ - [What would you want to test?](#what-would-you-want-to-test)

- [Additional options](#additional-options)
- [includeIdsInData](#includeidsindata)
- [mutable](#mutable)
- [simulateQueryFilters](#simulateQueryFilters)
- [`includeIdsInData`](#includeidsindata)
- [`mutable`](#mutable)
- [`simulateQueryFilters`](#simulatequeryfilters)
- [Functions you can test](#functions-you-can-test)

@@ -163,2 +164,38 @@ - [Firestore](#firestore)

### `@react-native-firebase/firestore` compatibility
If you use `@react-native-firebase/firestore`, use `mockGoogleCloudFirestore` instead of `mockFirebase` in all the documentation.
```js
const { mockGoogleCloudFirestore } = require('firestore-jest-mock');
mockGoogleCloudFirestore({
database: {
users: [
{ id: 'abc123', name: 'Homer Simpson' },
{ id: 'abc456', name: 'Lisa Simpson' },
],
posts: [{ id: '123abc', title: 'Really cool title' }],
},
});
const { mockCollection } = require('firestore-jest-mock/mocks/firestore');
test('testing stuff', () => {
const { Firestore } = require('@react-native-firebase/firestore');
const firestore = new Firestore();
return firestore
.collection('users')
.get()
.then(userDocs => {
expect(mockCollection).toHaveBeenCalledWith('users');
expect(userDocs[0].name).toEqual('Homer Simpson');
});
});
```
_Note: Authentication with `@react-native-firebase/firestore` is not handled in the same way as with `firebase`.
The `Auth` module is not available for `@react-native-firebase/firestore` compatibility._
### Subcollections

@@ -165,0 +202,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc