Skip to content

Commit

Permalink
Link update (#163)
Browse files Browse the repository at this point in the history
* fix: update expect assertion on @google-cloud/firestore test example

* fix: update link on mock-firestore.test.js

* fix: update links on firestore.js

* fix: update links on buildDocFromHash.js

* fix: update links on README
  • Loading branch information
catlynbowles authored Feb 16, 2023
1 parent 82bc67e commit 5df7167
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ If you need your tests to perform `where` queries on mock database data, you can
| `mockAdd` | Assert correct params are passed to add. Returns a promise resolving to the doc with new id | [add](https://googleapis.dev/nodejs/firestore/latest/CollectionReference.html#add) |
| `mockSet` | Assert correct params are passed to set. Returns a promise | [set](https://googleapis.dev/nodejs/firestore/latest/DocumentReference.html#set) |
| `mockDelete` | Assert delete is called on ref. Returns a promise | [delete](https://googleapis.dev/nodejs/firestore/latest/DocumentReference.html#delete) |
| `mockUseEmulator` | Assert correct host and port are passed | [useEmulator](https://firebase.google.com/docs/reference/js/firebase.firestore.Firestore#useemulator) |
| `mockUseEmulator` | Assert correct host and port are passed | [useEmulator](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Firestore#useemulator) |

#### [Firestore.Query](https://googleapis.dev/nodejs/firestore/latest/Query.html)

Expand All @@ -419,7 +419,7 @@ If you need your tests to perform `where` queries on mock database data, you can
| `mockOffset` | Assert offset is set properly | [offset](https://googleapis.dev/nodejs/firestore/latest/Query.html#offset) |
| `mockStartAfter` | Assert startAfter is called | [startAfter](https://googleapis.dev/nodejs/firestore/latest/Query.html#startAfter) |
| `mockStartAt` | Assert startAt is called | [startAt](https://googleapis.dev/nodejs/firestore/latest/Query.html#startAt) |
| `mockWithConverter` | Assert withConverter is called | [withConverter](https://firebase.google.com/docs/reference/js/firebase.firestore.Query#withconverter) |
| `mockWithConverter` | Assert withConverter is called | [withConverter](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Query#withconverter) |

#### [Firestore.FieldValue](https://googleapis.dev/nodejs/firestore/latest/FieldValue.html)

Expand Down Expand Up @@ -451,21 +451,21 @@ If you need your tests to perform `where` queries on mock database data, you can
| `mockUpdateTransaction` | Assert transaction.update is called with correct params. Returns the transaction object | [update](https://googleapis.dev/nodejs/firestore/latest/Transaction.html#update) |
| `mockDeleteTransaction` | Assert transaction.delete is called with correct params. Returns the transaction object | [delete](https://googleapis.dev/nodejs/firestore/latest/Transaction.html#delete) |

#### [Auth](https://firebase.google.com/docs/reference/js/firebase.auth.Auth)
#### [Auth](https://firebase.google.com/docs/reference/js/auth.auth)

| Method | Use | Method in Firebase |
| ------------------------------------ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `mockCreateUserWithEmailAndPassword` | Assert correct email and password are passed. Returns a promise | [createUserWithEmailAndPassword](https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#createuserwithemailandpassword) |
| `mockGetUser` | Assert correct user IDs are passed. Returns a promise | [getUser](https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth-1#getuser) |
| `mockDeleteUser` | Assert correct ID is passed to delete method. Returns a promise | [deleteUser](https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth-1#deleteuser) |
| `mockSendVerificationEmail` | Assert request for verification email was sent. Lives on the `currentUser` | [sendVerificationEmail](https://firebase.google.com/docs/reference/js/firebase.User#send-email-verification) |
| `mockCreateCustomToken` | Assert correct user ID and claims are passed. Returns a promise | [createCustomToken](https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth-1#createcustomtoken) |
| `mockSetCustomUserClaims` | Assert correct user ID and claims are set. | [setCustomUserClaims](https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth-1#setcustomuserclaims) |
| `mockSignInWithEmailAndPassword` | Assert correct email and password were passed. Returns a promise | [signInWithEmailAndPassword](https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithemailandpassword) |
| `mockSendPasswordResetEmail` | Assert correct email was passed. | [sendPasswordResetEmail](https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#send-password-reset-email) |
| `mockVerifyIdToken` | Assert correct token is passed. Returns a promise | [verifyIdToken](https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth-1#verifyidtoken) |
| `mockUseEmulator` | Assert correct emulator url is passed | [useEmulator](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#useemulator) |
| `mockSignOut` | Assert sign out is called. Returns a promise | [signOut](https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signout) |
| `mockCreateUserWithEmailAndPassword` | Assert correct email and password are passed. Returns a promise | [createUserWithEmailAndPassword](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#createuserwithemailandpassword) |
| `mockGetUser` | Assert correct user IDs are passed. Returns a promise | [getUser](https://firebase.google.com/docs/auth/admin/manage-users#retrieve_user_data) |
| `mockDeleteUser` | Assert correct ID is passed to delete method. Returns a promise | [deleteUser](https://firebase.google.com/docs/auth/admin/manage-users#delete_a_user) |
| `mockSendVerificationEmail` | Assert request for verification email was sent. Lives on the `currentUser` | [sendVerificationEmail](https://firebase.google.com/docs/reference/js/auth.md#sendemailverification) |
| `mockCreateCustomToken` | Assert correct user ID and claims are passed. Returns a promise | [createCustomToken](https://firebase.google.com/docs/auth/admin/create-custom-tokens) |
| `mockSetCustomUserClaims` | Assert correct user ID and claims are set. | [setCustomUserClaims](https://firebase.google.com/docs/auth/admin/custom-claims) |
| `mockSignInWithEmailAndPassword` | Assert correct email and password were passed. Returns a promise | [signInWithEmailAndPassword](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#signinwithemailandpassword) |
| `mockSendPasswordResetEmail` | Assert correct email was passed. | [sendPasswordResetEmail](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#sendpasswordresetemail) |
| `mockVerifyIdToken` | Assert correct token is passed. Returns a promise | [verifyIdToken](https://firebase.google.com/docs/auth/admin/verify-id-tokens) |
| `mockUseEmulator` | Assert correct emulator url is passed | [useEmulator](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#useemulator) |
| `mockSignOut` | Assert sign out is called. Returns a promise | [signOut](https://firebase.google.com/docs/reference/js/auth.auth.md#authsignout) |

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion __tests__/mock-firestore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe('Queries', () => {

test('New documents with random ID', async () => {
expect.assertions(2);
// See https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference#doc
// See https://firebase.google.com/docs/reference/js/firestore_#doc
// "If no path is specified, an automatically-generated unique ID will be used for the returned DocumentReference."
const col = db().collection('foo');
const newDoc = col.doc();
Expand Down
4 changes: 2 additions & 2 deletions mocks/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FakeFirestore {

collection(path) {
// Accept any collection path
// See https://firebase.google.com/docs/reference/js/firebase.firestore.Firestore#collection
// See https://firebase.google.com/docs/reference/js/firestore_#collection
mockCollection(...arguments);

if (path === undefined) {
Expand Down Expand Up @@ -130,7 +130,7 @@ class FakeFirestore {

_doc(path) {
// Accept any document path
// See https://firebase.google.com/docs/reference/js/firebase.firestore.Firestore#doc
// See https://firebase.google.com/docs/reference/js/firestore_#doc

if (path === undefined) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion mocks/helpers/buildDocFromHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function buildDocFromHash(hash = {}, id = 'abc123', selectField
data() {
if (!exists) {
// From Firestore docs: "Returns 'undefined' if the document doesn't exist."
// See https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentSnapshot#data
// See https://firebase.google.com/docs/reference/js/firestore_.documentsnapshot#documentsnapshotdata
return undefined;
}
let copy = { ...hash };
Expand Down

0 comments on commit 5df7167

Please sign in to comment.