@reactionary/examples-node 0.3.3 → 0.3.5
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.
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/examples-node",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@reactionary/core": "0.3.
|
|
8
|
-
"@reactionary/provider-commercetools": "0.3.
|
|
9
|
-
"@reactionary/provider-algolia": "0.3.
|
|
10
|
-
"@reactionary/provider-medusa": "0.3.
|
|
11
|
-
"@reactionary/provider-meilisearch": "0.3.
|
|
7
|
+
"@reactionary/core": "0.3.5",
|
|
8
|
+
"@reactionary/provider-commercetools": "0.3.5",
|
|
9
|
+
"@reactionary/provider-algolia": "0.3.5",
|
|
10
|
+
"@reactionary/provider-medusa": "0.3.5",
|
|
11
|
+
"@reactionary/provider-meilisearch": "0.3.5"
|
|
12
12
|
},
|
|
13
13
|
"type": "module"
|
|
14
14
|
}
|
|
@@ -76,6 +76,8 @@ describe.each([PrimaryProvider.MEILISEARCH])(
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
expect(result.value.length).toBeGreaterThan(0);
|
|
79
|
+
expect(result.value[0].product.key).toBeDefined();
|
|
80
|
+
expect(result.value[0].recommendationIdentifier.key).toBeDefined();
|
|
79
81
|
});
|
|
80
82
|
|
|
81
83
|
it('should return an empty result for an unknown sku', async () => {
|
|
@@ -94,3 +96,47 @@ describe.each([PrimaryProvider.MEILISEARCH])(
|
|
|
94
96
|
expect(result.value.length).toBe(0);
|
|
95
97
|
});
|
|
96
98
|
});
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
describe.each([PrimaryProvider.ALGOLIA])(
|
|
103
|
+
'Product Recommendations - Related - %s',
|
|
104
|
+
(provider) => {
|
|
105
|
+
let client: ReturnType<typeof createClient>;
|
|
106
|
+
|
|
107
|
+
beforeEach(() => {
|
|
108
|
+
client = createClient(provider);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('should be able to return a list of products for recommendation - Related ', async () => {
|
|
112
|
+
const result = await client.productRecommendations.getRecommendations({
|
|
113
|
+
algorithm: 'related',
|
|
114
|
+
sourceProduct: {
|
|
115
|
+
key: testData.product.id,
|
|
116
|
+
},
|
|
117
|
+
numberOfRecommendations: 10,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (!result.success) {
|
|
121
|
+
assert.fail(JSON.stringify(result.error));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
expect(result.value.length).toBeGreaterThan(0);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should return an empty result for an unknown sku', async () => {
|
|
128
|
+
const result = await client.productRecommendations.getRecommendations({
|
|
129
|
+
algorithm: 'related',
|
|
130
|
+
sourceProduct: {
|
|
131
|
+
key: 'unknown-product-id',
|
|
132
|
+
},
|
|
133
|
+
numberOfRecommendations: 10,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
if (!result.success) {
|
|
137
|
+
assert.fail(JSON.stringify(result.error));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
expect(result.value.length).toBe(0);
|
|
141
|
+
});
|
|
142
|
+
});
|