feat: Reset password (#8962)
* wip * more work * wip * more work * wrap up first iteration * work on new approach * more work * move middleware func to route * cleanup * more work * wrap up * more work * fix workflow * minor tweaks * finalize * Use JWT secret instead
This commit is contained in:
+6
-6
@@ -215,7 +215,7 @@ moduleIntegrationTestRunner<IAuthModuleService>({
|
||||
let error
|
||||
|
||||
try {
|
||||
await service.updateAuthIdentites([
|
||||
await service.updateAuthIdentities([
|
||||
{
|
||||
id: "does-not-exist",
|
||||
},
|
||||
@@ -230,7 +230,7 @@ moduleIntegrationTestRunner<IAuthModuleService>({
|
||||
})
|
||||
|
||||
it("should update authIdentity", async () => {
|
||||
await service.updateAuthIdentites([
|
||||
await service.updateAuthIdentities([
|
||||
{
|
||||
id,
|
||||
app_metadata: { email: "test@email.com" },
|
||||
@@ -364,7 +364,7 @@ moduleIntegrationTestRunner<IAuthModuleService>({
|
||||
let error
|
||||
|
||||
try {
|
||||
await service.updateProviderIdentites([
|
||||
await service.updateProviderIdentities([
|
||||
{
|
||||
id: "does-not-exist",
|
||||
},
|
||||
@@ -382,18 +382,18 @@ moduleIntegrationTestRunner<IAuthModuleService>({
|
||||
let [providerIdentity] = await service.listProviderIdentities({
|
||||
entity_id,
|
||||
})
|
||||
await service.updateProviderIdentites([
|
||||
await service.updateProviderIdentities([
|
||||
{
|
||||
id: providerIdentity.id,
|
||||
provider_metadata: { email: "test@email.com" },
|
||||
},
|
||||
])
|
||||
|
||||
const providerIdentites = await service.listProviderIdentities({
|
||||
const providerIdentities = await service.listProviderIdentities({
|
||||
id: [providerIdentity.id],
|
||||
})
|
||||
|
||||
expect(providerIdentites[0]).toEqual(
|
||||
expect(providerIdentities[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
provider_metadata: expect.objectContaining({
|
||||
email: "test@email.com",
|
||||
|
||||
+17
-3
@@ -1,8 +1,8 @@
|
||||
import { IAuthModuleService } from "@medusajs/types"
|
||||
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
|
||||
import { resolve } from "path"
|
||||
import { Module, Modules } from "@medusajs/utils"
|
||||
import { AuthModuleService } from "@services"
|
||||
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
|
||||
import { resolve } from "path"
|
||||
|
||||
let moduleOptions = {
|
||||
providers: [
|
||||
@@ -42,7 +42,10 @@ moduleIntegrationTestRunner({
|
||||
service: AuthModuleService,
|
||||
}).linkable
|
||||
|
||||
expect(Object.keys(linkable)).toEqual(["authIdentity"])
|
||||
expect(Object.keys(linkable)).toEqual([
|
||||
"authIdentity",
|
||||
"providerIdentity",
|
||||
])
|
||||
|
||||
linkable.authIdentity.toJSON = undefined
|
||||
|
||||
@@ -54,6 +57,17 @@ moduleIntegrationTestRunner({
|
||||
field: "authIdentity",
|
||||
},
|
||||
})
|
||||
|
||||
linkable.providerIdentity.toJSON = undefined
|
||||
|
||||
expect(linkable.providerIdentity).toEqual({
|
||||
id: {
|
||||
linkable: "provider_identity_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "auth",
|
||||
field: "providerIdentity",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it("it fails if the provider does not exist", async () => {
|
||||
|
||||
Reference in New Issue
Block a user