@gofynd/fdk-client-javascript 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +51 -2
  2. package/index.d.ts +7 -4
  3. package/index.js +22 -7
  4. package/package.json +23 -14
  5. package/partner.d.ts +4 -0
  6. package/partner.js +7 -0
  7. package/sdk/application/ApplicationAPIClient.js +2 -4
  8. package/sdk/application/Cart/CartApplicationClient.js +29 -28
  9. package/sdk/application/Cart/CartApplicationModel.js +3 -1
  10. package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
  11. package/sdk/application/Catalog/CatalogApplicationModel.js +5 -3
  12. package/sdk/application/Common/CommonApplicationClient.js +5 -4
  13. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
  14. package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
  15. package/sdk/application/Content/ContentApplicationClient.js +26 -25
  16. package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
  17. package/sdk/application/Lead/LeadApplicationClient.js +10 -9
  18. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
  19. package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
  20. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
  21. package/sdk/application/Order/OrderApplicationClient.js +15 -14
  22. package/sdk/application/Order/OrderApplicationModel.js +9 -0
  23. package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
  24. package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
  25. package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
  26. package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
  27. package/sdk/application/Share/ShareApplicationClient.js +10 -9
  28. package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
  29. package/sdk/application/User/UserApplicationClient.js +38 -37
  30. package/sdk/common/AxiosHelper.js +17 -6
  31. package/sdk/common/BaseOAuthClient.d.ts +17 -0
  32. package/sdk/common/BaseOAuthClient.js +67 -0
  33. package/sdk/common/RequestSigner.js +0 -5
  34. package/sdk/partner/OAuthClient.d.ts +14 -0
  35. package/sdk/partner/OAuthClient.js +112 -0
  36. package/sdk/partner/PartnerAPIClient.d.ts +12 -0
  37. package/sdk/partner/PartnerAPIClient.js +42 -0
  38. package/sdk/partner/PartnerClient.d.ts +6 -0
  39. package/sdk/partner/PartnerClient.js +17 -0
  40. package/sdk/partner/PartnerConfig.d.ts +30 -0
  41. package/sdk/partner/PartnerConfig.js +39 -0
  42. package/sdk/partner/index.d.ts +3 -0
  43. package/sdk/partner/index.js +5 -0
  44. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
  45. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
  46. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
  47. package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
  48. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
  49. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
  50. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
  51. package/sdk/platform/Billing/BillingPlatformClient.js +137 -2
  52. package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
  53. package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
  54. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
  55. package/sdk/platform/Billing/BillingPlatformValidator.js +15 -0
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
  57. package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
  58. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
  59. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
  60. package/sdk/platform/Cart/CartPlatformModel.js +7 -3
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
  65. package/sdk/platform/Catalog/CatalogPlatformModel.js +9 -9
  66. package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
  67. package/sdk/platform/Common/CommonPlatformClient.js +7 -18
  68. package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
  69. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
  70. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
  71. package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
  72. package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
  73. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
  74. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
  75. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
  76. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
  77. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
  78. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
  79. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -1
  80. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -1
  81. package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
  82. package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
  83. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
  84. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
  85. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
  86. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
  87. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
  88. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
  89. package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
  90. package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
  91. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
  92. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
  93. package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
  94. package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
  95. package/sdk/platform/OAuthClient.js +3 -9
  96. package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
  97. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
  98. package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
  99. package/sdk/platform/Order/OrderPlatformClient.js +16 -3
  100. package/sdk/platform/Order/OrderPlatformModel.js +1 -0
  101. package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
  102. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
  103. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
  104. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
  105. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
  106. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
  107. package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
  108. package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
  109. package/sdk/platform/PlatformApplicationClient.d.ts +5 -1
  110. package/sdk/platform/PlatformApplicationClient.js +4 -0
  111. package/sdk/platform/PlatformClient.d.ts +51 -12
  112. package/sdk/platform/PlatformClient.js +54 -11
  113. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +17 -19
  114. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +88 -83
  115. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
  116. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +8 -9
  117. package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
  118. package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
  119. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
  120. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
  121. package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
  122. package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
  123. package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
  124. package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
  125. package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
  126. package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
  127. package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
  128. package/.github/workflows/on_create_release.yml +0 -23
  129. package/.github/workflows/on_merge_main.yml +0 -38
  130. package/.github/workflows/on_pull_request.yml +0 -35
  131. package/.prettierrc +0 -5
  132. package/documentation/application/CART.md +0 -8771
  133. package/documentation/application/CATALOG.md +0 -8690
  134. package/documentation/application/COMMON.md +0 -325
  135. package/documentation/application/COMMUNICATION.md +0 -387
  136. package/documentation/application/CONFIGURATION.md +0 -2212
  137. package/documentation/application/CONTENT.md +0 -2629
  138. package/documentation/application/FILESTORAGE.md +0 -442
  139. package/documentation/application/LEAD.md +0 -1549
  140. package/documentation/application/LOGISTIC.md +0 -689
  141. package/documentation/application/ORDER.md +0 -2937
  142. package/documentation/application/PAYMENT.md +0 -4475
  143. package/documentation/application/POSCART.md +0 -9375
  144. package/documentation/application/README.md +0 -21
  145. package/documentation/application/REWARDS.md +0 -554
  146. package/documentation/application/SHARE.md +0 -635
  147. package/documentation/application/THEME.md +0 -5517
  148. package/documentation/application/USER.md +0 -3798
  149. package/documentation/platform/ANALYTICS.md +0 -1012
  150. package/documentation/platform/AUDITTRAIL.md +0 -493
  151. package/documentation/platform/BILLING.md +0 -1889
  152. package/documentation/platform/CART.md +0 -4711
  153. package/documentation/platform/CATALOG.md +0 -20522
  154. package/documentation/platform/COMMON.md +0 -325
  155. package/documentation/platform/COMMUNICATION.md +0 -4970
  156. package/documentation/platform/COMPANYPROFILE.md +0 -1646
  157. package/documentation/platform/CONFIGURATION.md +0 -6316
  158. package/documentation/platform/CONTENT.md +0 -8364
  159. package/documentation/platform/DISCOUNT.md +0 -767
  160. package/documentation/platform/FILESTORAGE.md +0 -945
  161. package/documentation/platform/INVENTORY.md +0 -1136
  162. package/documentation/platform/LEAD.md +0 -4394
  163. package/documentation/platform/ORDER.md +0 -6525
  164. package/documentation/platform/PARTNER.md +0 -193
  165. package/documentation/platform/PAYMENT.md +0 -3138
  166. package/documentation/platform/README.md +0 -27
  167. package/documentation/platform/REWARDS.md +0 -919
  168. package/documentation/platform/SHARE.md +0 -513
  169. package/documentation/platform/THEME.md +0 -35446
  170. package/documentation/platform/USER.md +0 -2174
  171. package/documentation/platform/WEBHOOK.md +0 -485
  172. package/documentation/public/CONFIGURATION.md +0 -325
  173. package/documentation/public/INVENTORY.md +0 -508
  174. package/documentation/public/WEBHOOK.md +0 -246
  175. package/jest.config.d.ts +0 -4
  176. package/jest.config.js +0 -6
  177. package/tests/application/catalog.spec.js +0 -54
  178. package/tests/common/action-url.spec.js +0 -35
  179. package/tests/common/schema/action-url.json +0 -178
  180. package/tests/common/schema/url-action.json +0 -683
  181. package/tests/common/url-action.spec.js +0 -48
  182. package/tests/helpers/cookie.helper.js +0 -31
  183. package/tests/helpers/oauth.helper.js +0 -43
  184. package/tests/platform/catalog.spec.js +0 -49
  185. package/tests/public/location.spec.js +0 -39
@@ -1,246 +0,0 @@
1
-
2
-
3
-
4
-
5
-
6
- ##### [Back to Public docs](./README.md)
7
-
8
- ## Webhook Methods
9
- Webhook dispatcher with retry and one event to many subscriber vice versa
10
-
11
- * [fetchAllWebhookEvents](#fetchallwebhookevents)
12
- * [queryWebhookEventDetails](#querywebhookeventdetails)
13
-
14
-
15
-
16
- ## Methods with example and description
17
-
18
-
19
-
20
-
21
- ### fetchAllWebhookEvents
22
- Get All Webhook Events
23
-
24
-
25
-
26
- ```javascript
27
- // Promise
28
- const promise = webhook.fetchAllWebhookEvents();
29
-
30
- // Async/Await
31
- const data = await webhook.fetchAllWebhookEvents();
32
- ```
33
-
34
-
35
-
36
-
37
-
38
-
39
- Get All Webhook Events
40
-
41
- *Returned Response:*
42
-
43
-
44
-
45
-
46
- [EventConfigResponse](#EventConfigResponse)
47
-
48
- Success
49
-
50
-
51
-
52
-
53
- <details>
54
- <summary><i>&nbsp; Example:</i></summary>
55
-
56
- ```json
57
-
58
- ```
59
- </details>
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
- ---
70
-
71
-
72
- ### queryWebhookEventDetails
73
- Send webhook event name, type, version, category in request body to get complete details of event from server
74
-
75
-
76
-
77
- ```javascript
78
- // Promise
79
- const promise = webhook.queryWebhookEventDetails({ body : value });
80
-
81
- // Async/Await
82
- const data = await webhook.queryWebhookEventDetails({ body : value });
83
- ```
84
-
85
-
86
-
87
-
88
-
89
- | Argument | Type | Required | Description |
90
- | --------- | ----- | -------- | ----------- |
91
- | body | [Array<EventConfigBase>](#Array<EventConfigBase>) | yes | Request body |
92
-
93
-
94
- Get Webhook Event Details for provided events
95
-
96
- *Returned Response:*
97
-
98
-
99
-
100
-
101
- [EventConfigResponse](#EventConfigResponse)
102
-
103
- Success
104
-
105
-
106
-
107
-
108
- <details>
109
- <summary><i>&nbsp; Example:</i></summary>
110
-
111
- ```json
112
-
113
- ```
114
- </details>
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
- ---
125
-
126
-
127
-
128
- ### Schemas
129
-
130
-
131
- #### [Association](#Association)
132
-
133
- | Properties | Type | Nullable | Description |
134
- | ---------- | ---- | -------- | ----------- || application_id | [string] | no | || company_id | number | no | || criteria | string | no | || extension_id | string | no | |
135
-
136
- ---
137
-
138
- #### [AuthMeta](#AuthMeta)
139
-
140
- | Properties | Type | Nullable | Description |
141
- | ---------- | ---- | -------- | ----------- || secret | string | no | || type | string | no | |
142
-
143
- ---
144
-
145
- #### [EventConfig](#EventConfig)
146
-
147
- | Properties | Type | Nullable | Description |
148
- | ---------- | ---- | -------- | ----------- || created_on | string | no | || description | string | no | || display_name | string | no | || event_category | string | no | || event_name | string | no | || event_type | string | no | || id | number | no | || version | string | no | |
149
-
150
- ---
151
-
152
- #### [EventConfigBase](#EventConfigBase)
153
-
154
- | Properties | Type | Nullable | Description |
155
- | ---------- | ---- | -------- | ----------- || event_category | string | no | || event_name | string | no | || event_type | string | no | || version | string | no | |
156
-
157
- ---
158
-
159
- #### [EventConfigList](#EventConfigList)
160
-
161
- | Properties | Type | Nullable | Description |
162
- | ---------- | ---- | -------- | ----------- || items | [[EventConfig](#EventConfig)] | no | || page | [Page](#Page) | no | |
163
-
164
- ---
165
-
166
- #### [EventConfigResponse](#EventConfigResponse)
167
-
168
- | Properties | Type | Nullable | Description |
169
- | ---------- | ---- | -------- | ----------- || event_configs | [[EventConfig](#EventConfig)] | no | |
170
-
171
- ---
172
-
173
- #### [EventPayload](#EventPayload)
174
-
175
- | Properties | Type | Nullable | Description |
176
- | ---------- | ---- | -------- | ----------- || event_name | string | no | || event_trace_id | string | no | || event_type | string | no | || id | number | no | || message_id | string | no | || status | boolean | no | || version | string | no | |
177
-
178
- ---
179
-
180
- #### [EventProcessedStatus](#EventProcessedStatus)
181
-
182
- | Properties | Type | Nullable | Description |
183
- | ---------- | ---- | -------- | ----------- || attempt | number | no | || created_on | string | no | || id | number | no | || processed_on | string | no | || response_code | string | no | || response_message | string | no | || status | boolean | no | || subscriber_id | string | no | |
184
-
185
- ---
186
-
187
- #### [Page](#Page)
188
-
189
- | Properties | Type | Nullable | Description |
190
- | ---------- | ---- | -------- | ----------- || current | number | no | || has_next | boolean | no | || has_previous | boolean | no | || item_total | number | no | || next_id | string | no | || size | number | no | || type | string | yes | |
191
-
192
- ---
193
-
194
- #### [SubscriberConfig](#SubscriberConfig)
195
-
196
- | Properties | Type | Nullable | Description |
197
- | ---------- | ---- | -------- | ----------- || association | [Association](#Association) | no | || auth_meta | [AuthMeta](#AuthMeta) | no | || custom_headers | string | no | || email_id | string | no | || event_id | [number] | no | || id | number | no | || name | string | no | || status | [SubscriberStatus](#SubscriberStatus) | no | || webhook_url | string | no | |
198
-
199
- ---
200
-
201
- #### [SubscriberConfigList](#SubscriberConfigList)
202
-
203
- | Properties | Type | Nullable | Description |
204
- | ---------- | ---- | -------- | ----------- || items | [[SubscriberResponse](#SubscriberResponse)] | no | || page | [Page](#Page) | no | |
205
-
206
- ---
207
-
208
- #### [SubscriberEvent](#SubscriberEvent)
209
-
210
- | Properties | Type | Nullable | Description |
211
- | ---------- | ---- | -------- | ----------- || created_date | string | no | || event_id | number | no | || id | number | no | || subscriber_id | number | no | |
212
-
213
- ---
214
-
215
- #### [SubscriberResponse](#SubscriberResponse)
216
-
217
- | Properties | Type | Nullable | Description |
218
- | ---------- | ---- | -------- | ----------- || association | [Association](#Association) | no | || auth_meta | [AuthMeta](#AuthMeta) | no | || created_on | string | no | || custom_headers | string | no | || email_id | string | no | || event_configs | [[EventConfig](#EventConfig)] | no | || id | number | no | || name | string | no | || status | [SubscriberStatus](#SubscriberStatus) | no | || updated_on | string | no | || webhook_url | string | no | |
219
-
220
- ---
221
-
222
-
223
-
224
-
225
- ### Enums
226
-
227
-
228
-
229
-
230
-
231
- #### [SubscriberStatus](#SubscriberStatus)
232
- Type : string
233
-
234
- | Name | Value | Description |
235
- | ---- | ----- | ----------- |
236
- | active | active | Status is active |
237
- | inactive | inactive | Status is inactive |
238
- | blocked | blocked | Subscriber is blocked by system due to multiple failed delivery attempts. |
239
-
240
- ---
241
-
242
-
243
-
244
-
245
-
246
-
package/jest.config.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export const verbose: boolean;
2
- export const testEnvironment: string;
3
- export const bail: boolean;
4
- export const testTimeout: number;
package/jest.config.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- verbose: true,
3
- testEnvironment: 'node',
4
- bail: true,
5
- testTimeout: 30000
6
- };
@@ -1,54 +0,0 @@
1
- const { ApplicationConfig, ApplicationClient } = require("../../index.js");
2
- const setupCookieInterceptor = require("../helpers/cookie.helper");
3
- require("dotenv").config();
4
- let applicationClient;
5
-
6
- beforeAll(() => {
7
- setupCookieInterceptor();
8
- const config = new ApplicationConfig({
9
- domain: "https://api.fynd.com",
10
- applicationID: "000000000000000000000001",
11
- applicationToken: "9502d710-5a22-11e9-a001-57d85417c280",
12
- locationDetails: {
13
- pincode: "385001",
14
- country: "India",
15
- city: "Ahmedabad",
16
- location: { longitude: "72.585022", latitude: "23.033863" },
17
- },
18
- });
19
- applicationClient = new ApplicationClient(config);
20
- applicationClient.setLocationDetails({
21
- pincode: "385002",
22
- country: "India",
23
- city: "Ahmedabad",
24
- location: { longitude: "72.585022", latitude: "23.033863" },
25
- });
26
- });
27
-
28
- afterAll(() => {
29
- applicationClient = null;
30
- });
31
-
32
- describe("Application Catalog Test Cases", () => {
33
- it("getProducts testing", async () => {
34
- let products = await applicationClient.catalog.getProducts();
35
- expect(products.items.length).toBeGreaterThan(0);
36
- });
37
- });
38
-
39
- describe("Application Common Test Cases ", () => {
40
- it("search application by name", async () => {
41
- let locations = await applicationClient.common.searchApplication({
42
- authorization: `Basic ${process.env.AUTH_HEADER}`,
43
- query: "pc.fyndstore.co",
44
- });
45
- expect(locations && typeof locations === "object").toBe(true);
46
- });
47
- });
48
-
49
- describe("Application Content Test Cases ", () => {
50
- it("getNavigations test", async () => {
51
- let res = await applicationClient.content.getNavigations();
52
- expect(res).not.toBeNull();
53
- });
54
- });
@@ -1,35 +0,0 @@
1
- const { convertActionToUrl } = require("../../sdk/common/Utility");
2
- const actionToUrlConvert = require("./schema/action-url.json");
3
-
4
- describe("Convert to URl from ActionObject", () => {
5
- //loop over test cases json
6
- actionToUrlConvert.tests.forEach((test) => {
7
- it(test.name, () => {
8
- let path = convertActionToUrl(test.action);
9
- expect(path).toEqual(test.result.path);
10
- });
11
- });
12
-
13
- it("empty object as actionObj", () => {
14
- let path = convertActionToUrl({});
15
- expect(path).toEqual("");
16
- });
17
-
18
- it("null as actionObj", () => {
19
- let path = convertActionToUrl(null);
20
- expect(path).toEqual("");
21
- });
22
-
23
- it("wrong actionObj format", () => {
24
- let testObj = {
25
- type: "page",
26
- page: {
27
- params: {
28
- slug: ["test-product", "test-product-2"],
29
- },
30
- },
31
- };
32
- let path = convertActionToUrl(testObj);
33
- expect(path).toEqual("");
34
- });
35
- });
@@ -1,178 +0,0 @@
1
- {
2
- "tests": [
3
- {
4
- "name": "brand listing query param ",
5
- "action": {
6
- "type": "page",
7
- "page": {
8
- "type": "brand",
9
- "params": {
10
- "slug": ["test"]
11
- },
12
- "query": {
13
- "department": ["men", "women"]
14
- }
15
- }
16
- },
17
- "result": {
18
- "path": "/brand/test/?department=men&department=women"
19
- }
20
- },
21
- {
22
- "name": "profile order shipments",
23
- "action": {
24
- "type": "page",
25
- "page": {
26
- "type": "profile-order-shipment",
27
- "params": {
28
- "shipmentid": [16720482187091110000]
29
- }
30
- }
31
- },
32
- "result": {
33
- "path": "/profile/orders/shipment/16720482187091110000"
34
- }
35
- },
36
- {
37
- "name": "category listing query param ",
38
- "action": {
39
- "type": "page",
40
- "page": {
41
- "type": "category",
42
- "params": {
43
- "slug": ["test"]
44
- },
45
- "query": {
46
- "department": ["men", "women"]
47
- }
48
- }
49
- },
50
- "result": {
51
- "path": "/category/test/?department=men&department=women"
52
- }
53
- },
54
- {
55
- "name": "products listing query param ",
56
- "action": {
57
- "type": "page",
58
- "page": {
59
- "type": "products",
60
- "query": {
61
- "department": ["men", "women"]
62
- }
63
- }
64
- },
65
- "result": {
66
- "path": "/products/?department=men&department=women"
67
- }
68
- },
69
- {
70
- "name": "external url action to link",
71
- "action": {
72
- "type": "page",
73
- "page": {
74
- "type": "external",
75
- "query": {
76
- "url": ["https://abhay.dev"]
77
- }
78
- }
79
- },
80
- "result": {
81
- "path": "/external/?url=https%3A%2F%2Fabhay.dev"
82
- }
83
- },
84
- {
85
- "name": "Sections with group ",
86
- "action": {
87
- "type": "page",
88
- "page": {
89
- "type": "sections",
90
- "params": {
91
- "group": ["home"]
92
- }
93
- }
94
- },
95
- "result": {
96
- "path": "/sections/home"
97
- }
98
- },
99
- {
100
- "name": "Review page",
101
- "action": {
102
- "type": "page",
103
- "page": {
104
- "type": "product-reviews",
105
- "params": {
106
- "slug": ["test-product"]
107
- }
108
- }
109
- },
110
- "result": {
111
- "path": "/product/test-product/reviews"
112
- }
113
- },
114
- {
115
- "name": "Multiple slugs",
116
- "action": {
117
- "type": "page",
118
- "page": {
119
- "type": "product-reviews",
120
- "params": {
121
- "slug": ["test-product", "test-product-2"]
122
- }
123
- }
124
- },
125
- "result": {
126
- "path": "/product/test-product:::test-product-2/reviews"
127
- }
128
- },
129
- {
130
- "name": "login page ",
131
- "action": {
132
- "type": "page",
133
- "page": {
134
- "type": "login"
135
- }
136
- },
137
- "result": {
138
- "path": "/auth/login"
139
- }
140
- },
141
- {
142
- "name": "register page ",
143
- "action": {
144
- "type": "page",
145
- "page": {
146
- "type": "register"
147
- }
148
- },
149
- "result": {
150
- "path": "/auth/register"
151
- }
152
- },
153
- {
154
- "name": "Shipping policy ",
155
- "action": {
156
- "type": "page",
157
- "page": {
158
- "type": "shipping-policy"
159
- }
160
- },
161
- "result": {
162
- "path": "/shipping-policy"
163
- }
164
- },
165
- {
166
- "name": "Return policy ",
167
- "action": {
168
- "type": "page",
169
- "page": {
170
- "type": "return-policy"
171
- }
172
- },
173
- "result": {
174
- "path": "/return-policy"
175
- }
176
- }
177
- ]
178
- }