-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: test coverage and build types
- Loading branch information
Showing
10 changed files
with
100 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@shopware-pwa/helpers](./helpers.md) > [getProductReviews](./helpers.getproductreviews.md) | ||
|
||
## getProductReviews() function | ||
|
||
Format product reviews to ui-interfaces | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function getProductReviews({ product, }?: { | ||
product?: Product; | ||
}): UiProductReview[]; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| { product, } | { product?: Product; } | | | ||
|
||
<b>Returns:</b> | ||
|
||
[UiProductReview](./helpers.uiproductreview.md)<!-- -->\[\] | ||
|
||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@shopware-pwa/helpers](./helpers.md) > [getProductReviews](./helpers.getproductreviews.md) | ||
|
||
## getProductReviews() function | ||
|
||
Format product reviews to ui-interfaces | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function getProductReviews({ product, }?: { | ||
product?: Product; | ||
}): UiProductReview[]; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| { product, } | { product?: Product; } | | | ||
|
||
<b>Returns:</b> | ||
|
||
[UiProductReview](./helpers.uiproductreview.md)<!-- -->\[\] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@shopware-pwa/shopware-6-client](./shopware-6-client.md) > [getSeoUrl](./shopware-6-client.getseourl.md) | ||
|
||
## getSeoUrl() function | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function getSeoUrl(params: ShopwareSearchParams, contextInstance?: ShopwareApiInstance): Promise<EntityResult<"seo_url", SeoUrl[]>>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| params | ShopwareSearchParams | | | ||
| contextInstance | [ShopwareApiInstance](./shopware-6-client.shopwareapiinstance.md) | | | ||
|
||
<b>Returns:</b> | ||
|
||
Promise<EntityResult<"seo\_url", SeoUrl\[\]>> | ||
|
||
## Exceptions | ||
|
||
ClientApiError | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/shopware-6-client/__tests__/services/PageService/getSeoUrl.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { getSeoUrl } from "@shopware-pwa/shopware-6-client"; | ||
import { defaultInstance } from "../../../src/apiService"; | ||
|
||
jest.mock("../../../src/apiService"); | ||
const mockedApiInstance = defaultInstance as jest.Mocked< | ||
typeof defaultInstance | ||
>; | ||
|
||
describe("PageService - getSeoUrl", () => { | ||
const mockedPost = jest.fn(); | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
mockedApiInstance.invoke = { | ||
post: mockedPost, | ||
} as any; | ||
}); | ||
it("should return seo url entities for given criteria", async () => { | ||
mockedPost.mockResolvedValueOnce({ | ||
data: { elements: [{ id: "b218f861361042f3a58a2a9d1b3575b5" }] }, | ||
}); | ||
const result = await getSeoUrl({ | ||
limit: 3, | ||
}); | ||
expect(mockedPost).toBeCalledTimes(1); | ||
expect(mockedPost).toBeCalledWith("/store-api/seo-url", { | ||
limit: 3, | ||
}); | ||
expect(result).toHaveProperty("elements"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters