コード例 #1
0
 it('should send correct payload', async () => {
   fetchMock.patchOnce(
     `https://samples.auth0.com/api/v2/users/${encodeURIComponent(userId)}`,
     user
   );
   expect.assertions(1);
   await users.patchUser({ id: userId, metadata });
   expect(fetchMock.lastCall()).toMatchSnapshot();
 });
コード例 #2
0
 it('should return successful response', async () => {
   fetchMock.patchOnce(
     `https://samples.auth0.com/api/v2/users/${encodeURIComponent(userId)}`,
     user
   );
   expect.assertions(1);
   await expect(
     users.patchUser({ id: userId, metadata })
   ).resolves.toMatchSnapshot();
 });
コード例 #3
0
 it('should handle unexpected error', async () => {
   fetchMock.patchOnce(
     `https://samples.auth0.com/api/v2/users/${encodeURIComponent(userId)}`,
     unexpectedError
   );
   expect.assertions(1);
   await expect(
     users.patchUser({ id: userId, metadata })
   ).rejects.toMatchSnapshot();
 });