Skip to content

Commit

Permalink
fix: use correct node to detect two step registration (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Oct 24, 2024
1 parent 56cc1b7 commit d719e15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ describe("CardTwoStep/utils", () => {
})

describe("isChoosingMethod", () => {
test("should return true if a node has value 'profile:back'", () => {
test("should return true if a node has value 'screen=previous'", () => {
const uiNodes: UiNode[] = [
{
attributes: { value: "profile:back" } as UiNodeAttributes,
attributes: { value: "previous", name: "screen" } as UiNodeAttributes,
group: UiNodeGroupEnum.Default,
} as UiNode,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import { UiNode, UiNodeGroupEnum } from "@ory/client-fetch"

export function isChoosingMethod(uiNodes: UiNode[]): boolean {
console.log(uiNodes)
return (
uiNodes.some(
(node) =>
"value" in node.attributes && node.attributes.value === "profile:back",
"name" in node.attributes &&
node.attributes.name === "screen" &&
"value" in node.attributes &&
node.attributes.value === "previous",
) ||
uiNodes.some(
(node) =>
Expand Down

0 comments on commit d719e15

Please sign in to comment.