Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix: tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
patzick committed May 21, 2020
1 parent 461d079 commit 29bc328
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,25 @@ describe("CustomerService - resetPassword", () => {
}
);
});

it("should set storefrontUrl from config if not provided with params ", async () => {
await resetPassword({
email: credentials.email,
});
expect(mockedAxios.post).toBeCalledWith(
"/store-api/v1/account/recovery-password",
{
email: credentials.email,
storefrontUrl: "https://shopware6-demo.vuestorefront.io",
}
);
});

it("should invokde post method with null if params are not provided", async () => {
await resetPassword(null as any);
expect(mockedAxios.post).toBeCalledWith(
"/store-api/v1/account/recovery-password",
null
);
});
});
3 changes: 1 addition & 2 deletions packages/shopware-6-client/src/services/customerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ export interface CustomerResetPasswordParam {
export async function resetPassword(
params: CustomerResetPasswordParam
): Promise<void> {
/* istanbul ignore next */
if (!params?.storefrontUrl) {
if (params && !params.storefrontUrl) {
params.storefrontUrl = config.endpoint;
}

Expand Down

0 comments on commit 29bc328

Please sign in to comment.