From 5df71673147166c6d9ff2ca09d07709e96675d90 Mon Sep 17 00:00:00 2001 From: Catlyn Bowles Date: Thu, 16 Feb 2023 08:24:05 -1000 Subject: [PATCH] Link update (#163) * 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 --- README.md | 28 ++++++++++++++-------------- __tests__/mock-firestore.test.js | 2 +- mocks/firestore.js | 4 ++-- mocks/helpers/buildDocFromHash.js | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4c8ccd5..b4147b0 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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) @@ -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 diff --git a/__tests__/mock-firestore.test.js b/__tests__/mock-firestore.test.js index f81503f..d346b66 100644 --- a/__tests__/mock-firestore.test.js +++ b/__tests__/mock-firestore.test.js @@ -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(); diff --git a/mocks/firestore.js b/mocks/firestore.js index d5129f9..5ccb63a 100644 --- a/mocks/firestore.js +++ b/mocks/firestore.js @@ -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) { @@ -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( diff --git a/mocks/helpers/buildDocFromHash.js b/mocks/helpers/buildDocFromHash.js index d559e67..c5114c5 100644 --- a/mocks/helpers/buildDocFromHash.js +++ b/mocks/helpers/buildDocFromHash.js @@ -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 };