@faststore/core 4.7.0-dev.3 → 4.7.0-dev.4

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.
@@ -1,88 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
-
3
- import { hasEnabledRecommendationShelf } from 'src/sdk/analytics/utils/hasEnabledRecommendationShelf'
4
-
5
- describe('hasEnabledRecommendationShelf', () => {
6
- it('returns false for empty or unrelated page props', () => {
7
- expect(hasEnabledRecommendationShelf(undefined)).toBe(false)
8
- expect(hasEnabledRecommendationShelf({})).toBe(false)
9
- expect(
10
- hasEnabledRecommendationShelf({
11
- sections: [{ name: 'ProductShelf', data: {} }],
12
- })
13
- ).toBe(false)
14
- })
15
-
16
- it('returns true when a page section enables recommendations', () => {
17
- expect(
18
- hasEnabledRecommendationShelf({
19
- sections: [
20
- {
21
- name: 'RecommendationShelf',
22
- data: { enableRecommendations: true, campaignVrn: 'vrn:x' },
23
- },
24
- ],
25
- })
26
- ).toBe(true)
27
- })
28
-
29
- it('returns true when a global section enables recommendations', () => {
30
- expect(
31
- hasEnabledRecommendationShelf({
32
- globalSections: {
33
- sections: [
34
- {
35
- $componentKey: 'RecommendationShelf',
36
- data: { enableRecommendations: true },
37
- },
38
- ],
39
- },
40
- })
41
- ).toBe(true)
42
- })
43
-
44
- it('returns true when page.sections enables recommendations', () => {
45
- expect(
46
- hasEnabledRecommendationShelf({
47
- page: {
48
- sections: [
49
- {
50
- name: 'RecommendationShelf',
51
- data: { enableRecommendations: true },
52
- },
53
- ],
54
- },
55
- })
56
- ).toBe(true)
57
- })
58
-
59
- it('returns false when the shelf is present but enableRecommendations is false', () => {
60
- expect(
61
- hasEnabledRecommendationShelf({
62
- sections: [
63
- {
64
- name: 'RecommendationShelf',
65
- data: { enableRecommendations: false },
66
- },
67
- ],
68
- })
69
- ).toBe(false)
70
- })
71
-
72
- it('returns true when at least one of multiple shelves enables recommendations', () => {
73
- expect(
74
- hasEnabledRecommendationShelf({
75
- sections: [
76
- {
77
- name: 'RecommendationShelf',
78
- data: { enableRecommendations: false },
79
- },
80
- {
81
- name: 'RecommendationShelf',
82
- data: { enableRecommendations: true },
83
- },
84
- ],
85
- })
86
- ).toBe(true)
87
- })
88
- })