Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract API implementations from Post Login API #12

Merged
merged 13 commits into from
Apr 11, 2024
Merged

Conversation

matt-wratt
Copy link
Member

@matt-wratt matt-wratt commented Apr 9, 2024

Starting point to DRY up API implementation so behaviour can be shared across flows.

@matt-wratt matt-wratt force-pushed the extract-apis branch 4 times, most recently from 6cc1293 to 05345c5 Compare April 10, 2024 22:44
@matt-wratt matt-wratt marked this pull request as ready for review April 10, 2024 22:54
@matt-wratt matt-wratt force-pushed the extract-apis branch 2 times, most recently from f938640 to c0535e7 Compare April 10, 2024 23:35
@matt-wratt matt-wratt force-pushed the extract-apis branch 2 times, most recently from 4a63776 to b4e1b3c Compare April 11, 2024 01:54
"compilerOptions": {
"moduleResolution": "nodenext"
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was in place to help type hinting (e.g. in VS Code). Have agreed to back this out as we're no longer depending on complicated TS exports.

"/sandwich-preferences",
"Unexpected redirect URL path"
);

// Test the signed JWT data payload
const { session_token } = redirect.queryParams;
const { session_token } = redirect.target.queryParams;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll revert this in the future (e.g. with a Proxy object) as this just creates an unnecessary property to have to type. See #19.


const build = <T>(api: T) => ({
wasExecuted: (ruleId: string) => {
return state.executed.includes(ruleId);;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return state.executed.includes(ruleId);;
return state.executed.includes(ruleId);

export function rulesMock(flow: string, { executedRules = [] }: { executedRules?: string[] } = {}) {
const state = {
executed: executedRules,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not put this in the state for now. It's only a value you can set in your preconditions. An Action can't modify this, so there will never be a need to test it in postconditions.

@Aupajo Aupajo changed the title Extract APIs Extract Post Login APIs Apr 11, 2024
@Aupajo Aupajo changed the title Extract Post Login APIs Extract API implementations from Post Login API Apr 11, 2024
@matt-wratt matt-wratt merged commit 5ee473b into main Apr 11, 2024
1 check passed
@matt-wratt matt-wratt deleted the extract-apis branch April 11, 2024 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants