@getmicdrop/svelte-components 2.0.5 → 2.0.7

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 (102) hide show
  1. package/dist/components/Alert/Alert.spec.js +170 -170
  2. package/dist/components/Badges/Badge.spec.js +103 -103
  3. package/dist/components/BottomSheet/BottomSheet.spec.js +127 -127
  4. package/dist/components/Breadcrumb/Breadcrumb.spec.js +120 -120
  5. package/dist/components/Button/Button.spec.js +211 -211
  6. package/dist/components/Button/ButtonSaveDemo.spec.js +48 -48
  7. package/dist/components/Calendar/Calendar.spec.js +131 -131
  8. package/dist/components/Calendar/QuarterView.spec.js +394 -394
  9. package/dist/components/Card.spec.js +47 -47
  10. package/dist/components/CropImage/CropImage.spec.js +216 -216
  11. package/dist/components/DarkModeToggle.spec.js +357 -357
  12. package/dist/components/ErrorDisplay.spec.js +69 -69
  13. package/dist/components/FormActions.spec.js +88 -88
  14. package/dist/components/FormValidationSummary.spec.js +203 -203
  15. package/dist/components/Icons/Icon.spec.js +175 -175
  16. package/dist/components/Icons/MoreHori.spec.js +67 -67
  17. package/dist/components/Icons/WarningIcon.spec.js +30 -30
  18. package/dist/components/Input/Input.spec.js +573 -573
  19. package/dist/components/Input/MultiSelect.spec.js +257 -257
  20. package/dist/components/Input/OTPInput.spec.js +238 -238
  21. package/dist/components/Input/Select.spec.js +218 -218
  22. package/dist/components/Layout/BottomNav.spec.js +130 -130
  23. package/dist/components/Layout/Header.spec.js +203 -203
  24. package/dist/components/Modal/ConfirmationModal.spec.js +191 -191
  25. package/dist/components/Modal/Modal.spec.js +95 -95
  26. package/dist/components/Modal/ModalStateManager.spec.js +100 -100
  27. package/dist/components/PageLoader.spec.js +54 -54
  28. package/dist/components/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +173 -173
  29. package/dist/components/PlaceAutocomplete/PlaceAutocomplete.spec.js +300 -300
  30. package/dist/components/Spinner/Spinner.spec.js +75 -75
  31. package/dist/components/StatusIndicator/StatusIndicator.spec.js +129 -129
  32. package/dist/components/Toggle.spec.js +158 -158
  33. package/dist/components/ValidationError.spec.js +79 -79
  34. package/dist/components/pages/performers/AvailabilityCalendarModal.spec.js +606 -606
  35. package/dist/components/pages/performers/ModalShowInfo.spec.js +124 -124
  36. package/dist/components/pages/performers/PageBackButton.spec.js +89 -89
  37. package/dist/components/pages/performers/SectionHeader.spec.js +75 -75
  38. package/dist/components/pages/performers/ShowDetails.spec.js +166 -166
  39. package/dist/components/pages/performers/ShowItemCard.spec.js +793 -793
  40. package/dist/components/pages/performers/ShowItemCard.svelte +1 -1
  41. package/dist/components/pages/performers/SwitchOption.spec.js +127 -127
  42. package/dist/components/pages/performers/VenueInfo.spec.js +167 -167
  43. package/dist/components/pages/performers/VenueItemCard.spec.js +763 -763
  44. package/dist/components/pages/profile/profile-form.spec.js +9 -9
  45. package/dist/components/pages/settings/tabs/CustomImageDropzone.svelte +3 -3
  46. package/dist/components/pages/shows/ShowList.spec.js +33 -33
  47. package/dist/components/pages/shows/TabContent.spec.js +90 -90
  48. package/dist/components/pages/shows/TabNavigation.spec.js +143 -143
  49. package/dist/config.js +5 -5
  50. package/dist/config.spec.js +29 -29
  51. package/dist/constants/formOptions.js +25 -25
  52. package/dist/constants/formOptions.spec.js +88 -88
  53. package/dist/index.js +111 -111
  54. package/dist/stores/auth.d.ts +9 -0
  55. package/dist/stores/auth.d.ts.map +1 -0
  56. package/dist/stores/auth.js +36 -0
  57. package/dist/stores/auth.spec.d.ts +2 -0
  58. package/dist/stores/auth.spec.d.ts.map +1 -0
  59. package/dist/stores/auth.spec.js +139 -0
  60. package/dist/stores/formDataStore.d.ts +17 -0
  61. package/dist/stores/formDataStore.d.ts.map +1 -0
  62. package/dist/stores/formDataStore.js +25 -0
  63. package/dist/stores/formDataStore.spec.d.ts +2 -0
  64. package/dist/stores/formDataStore.spec.d.ts.map +1 -0
  65. package/dist/stores/formDataStore.spec.js +257 -0
  66. package/dist/stores/formSave.d.ts +24 -0
  67. package/dist/stores/formSave.d.ts.map +1 -0
  68. package/dist/stores/formSave.js +132 -0
  69. package/dist/stores/formSave.spec.d.ts +2 -0
  70. package/dist/stores/formSave.spec.d.ts.map +1 -0
  71. package/dist/stores/formSave.spec.js +296 -0
  72. package/dist/stores/index.d.ts +1 -0
  73. package/dist/stores/index.d.ts.map +1 -0
  74. package/dist/stores/index.js +0 -0
  75. package/dist/stores/navigation.d.ts +5 -0
  76. package/dist/stores/navigation.d.ts.map +1 -0
  77. package/dist/stores/navigation.js +12 -0
  78. package/dist/stores/navigation.spec.d.ts +2 -0
  79. package/dist/stores/navigation.spec.d.ts.map +1 -0
  80. package/dist/stores/navigation.spec.js +136 -0
  81. package/dist/stores/toaster.d.ts +4 -0
  82. package/dist/stores/toaster.d.ts.map +1 -0
  83. package/dist/stores/toaster.js +13 -0
  84. package/dist/stores/toaster.spec.d.ts +2 -0
  85. package/dist/stores/toaster.spec.d.ts.map +1 -0
  86. package/dist/stores/toaster.spec.js +59 -0
  87. package/dist/telemetry.js +357 -357
  88. package/dist/telemetry.server.js +211 -211
  89. package/dist/telemetry.server.spec.js +434 -434
  90. package/dist/telemetry.spec.js +660 -660
  91. package/dist/utils/apiConfig.js +49 -49
  92. package/dist/utils/apiConfig.spec.js +118 -118
  93. package/dist/utils/greetings.js +187 -187
  94. package/dist/utils/greetings.spec.js +337 -337
  95. package/dist/utils/imageValidation.js +121 -121
  96. package/dist/utils/imageValidation.spec.js +220 -220
  97. package/dist/utils/portal.js +25 -25
  98. package/dist/utils/portal.spec.js +143 -143
  99. package/dist/utils/utils/utils.js +323 -323
  100. package/dist/utils/utils/utils.spec.js +698 -698
  101. package/dist/utils/utils.spec.js +643 -643
  102. package/package.json +1 -1
@@ -17,7 +17,7 @@
17
17
  cancelInvite,
18
18
  sendVenueMessage,
19
19
  getEventUrl,
20
- } from "../../../../services/ShowService";
20
+ } from "../../../services/ShowService";
21
21
  import { Dropdown, DropdownItem } from "flowbite-svelte";
22
22
  import { DotsHorizontalOutline, FileCopyOutline } from "flowbite-svelte-icons";
23
23
  import { onMount } from "svelte";
@@ -1,127 +1,127 @@
1
- import { render, screen, fireEvent } from "@testing-library/svelte";
2
- import userEvent from "@testing-library/user-event";
3
- import { expect, describe, test, vi } from "vitest";
4
- import SwitchOption from "./SwitchOption.svelte";
5
-
6
- function setupTest(args = {}) {
7
- const user = userEvent.setup();
8
- const onToggle = vi.fn();
9
- const { component, container } = render(SwitchOption, {
10
- props: {
11
- label: "Test Switch",
12
- checked: false,
13
- onToggle,
14
- ...args,
15
- },
16
- });
17
- return { user, component, container, onToggle };
18
- }
19
-
20
- describe("SwitchOption Component Tests", () => {
21
- test("Renders switch with label", () => {
22
- setupTest({ label: "Enable Feature" });
23
- expect(screen.getByText("Enable Feature")).toBeInTheDocument();
24
- });
25
-
26
- test("Renders checkbox input", () => {
27
- setupTest();
28
- const checkbox = screen.getByRole("checkbox");
29
- expect(checkbox).toBeInTheDocument();
30
- });
31
-
32
- test("Checkbox is hidden for accessibility (sr-only)", () => {
33
- setupTest();
34
- const checkbox = screen.getByRole("checkbox");
35
- expect(checkbox).toHaveClass("sr-only");
36
- });
37
-
38
- test("Checkbox is unchecked by default", () => {
39
- setupTest({ checked: false });
40
- const checkbox = screen.getByRole("checkbox");
41
- expect(checkbox).not.toBeChecked();
42
- });
43
-
44
- test("Checkbox is checked when checked prop is true", () => {
45
- setupTest({ checked: true });
46
- const checkbox = screen.getByRole("checkbox");
47
- expect(checkbox).toBeChecked();
48
- });
49
-
50
- test("Calls onToggle when clicked", async () => {
51
- const { user, onToggle } = setupTest();
52
- const checkbox = screen.getByRole("checkbox");
53
-
54
- await user.click(checkbox);
55
-
56
- expect(onToggle).toHaveBeenCalledTimes(1);
57
- });
58
-
59
- test("Passes checked state to onToggle", async () => {
60
- const { user, onToggle } = setupTest({ checked: false });
61
- const checkbox = screen.getByRole("checkbox");
62
-
63
- await user.click(checkbox);
64
-
65
- // After clicking, checkbox becomes checked (true)
66
- expect(onToggle).toHaveBeenCalledWith(true);
67
- });
68
-
69
- test("Has full width container", () => {
70
- const { container } = setupTest();
71
- const wrapper = container.firstChild;
72
- expect(wrapper).toHaveClass("w-full");
73
- });
74
-
75
- test("Uses flexbox layout", () => {
76
- const { container } = setupTest();
77
- const wrapper = container.firstChild;
78
- expect(wrapper).toHaveClass("flex");
79
- expect(wrapper).toHaveClass("items-center");
80
- expect(wrapper).toHaveClass("justify-between");
81
- });
82
-
83
- test("Label has correct styling", () => {
84
- setupTest({ label: "My Label" });
85
- const label = screen.getByText("My Label");
86
- expect(label).toHaveClass("text-sm");
87
- expect(label).toHaveClass("font-medium");
88
- expect(label).toHaveClass("text-gray-700");
89
- });
90
-
91
- test("Has pointer cursor on label", () => {
92
- const { container } = setupTest();
93
- const labelElement = container.querySelector("label");
94
- expect(labelElement).toHaveClass("cursor-pointer");
95
- });
96
-
97
- test("Toggle track has correct base classes", () => {
98
- const { container } = setupTest();
99
- const track = container.querySelector(".bg-gray-200");
100
- expect(track).toBeInTheDocument();
101
- expect(track).toHaveClass("rounded-full");
102
- expect(track).toHaveClass("w-11");
103
- expect(track).toHaveClass("h-6");
104
- });
105
-
106
- test("Toggle knob has correct base classes", () => {
107
- const { container } = setupTest();
108
- const knob = container.querySelector(".bg-white");
109
- expect(knob).toBeInTheDocument();
110
- expect(knob).toHaveClass("rounded-full");
111
- expect(knob).toHaveClass("w-5");
112
- expect(knob).toHaveClass("h-5");
113
- });
114
-
115
- test("Updates visual state on toggle", async () => {
116
- const { user, container, component } = setupTest({ checked: false });
117
- const checkbox = screen.getByRole("checkbox");
118
-
119
- // Initially unchecked
120
- expect(checkbox).not.toBeChecked();
121
-
122
- await user.click(checkbox);
123
-
124
- // The component's checked state should update
125
- expect(checkbox).toBeChecked();
126
- });
127
- });
1
+ import { render, screen, fireEvent } from "@testing-library/svelte";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { expect, describe, test, vi } from "vitest";
4
+ import SwitchOption from "./SwitchOption.svelte";
5
+
6
+ function setupTest(args = {}) {
7
+ const user = userEvent.setup();
8
+ const onToggle = vi.fn();
9
+ const { component, container } = render(SwitchOption, {
10
+ props: {
11
+ label: "Test Switch",
12
+ checked: false,
13
+ onToggle,
14
+ ...args,
15
+ },
16
+ });
17
+ return { user, component, container, onToggle };
18
+ }
19
+
20
+ describe("SwitchOption Component Tests", () => {
21
+ test("Renders switch with label", () => {
22
+ setupTest({ label: "Enable Feature" });
23
+ expect(screen.getByText("Enable Feature")).toBeInTheDocument();
24
+ });
25
+
26
+ test("Renders checkbox input", () => {
27
+ setupTest();
28
+ const checkbox = screen.getByRole("checkbox");
29
+ expect(checkbox).toBeInTheDocument();
30
+ });
31
+
32
+ test("Checkbox is hidden for accessibility (sr-only)", () => {
33
+ setupTest();
34
+ const checkbox = screen.getByRole("checkbox");
35
+ expect(checkbox).toHaveClass("sr-only");
36
+ });
37
+
38
+ test("Checkbox is unchecked by default", () => {
39
+ setupTest({ checked: false });
40
+ const checkbox = screen.getByRole("checkbox");
41
+ expect(checkbox).not.toBeChecked();
42
+ });
43
+
44
+ test("Checkbox is checked when checked prop is true", () => {
45
+ setupTest({ checked: true });
46
+ const checkbox = screen.getByRole("checkbox");
47
+ expect(checkbox).toBeChecked();
48
+ });
49
+
50
+ test("Calls onToggle when clicked", async () => {
51
+ const { user, onToggle } = setupTest();
52
+ const checkbox = screen.getByRole("checkbox");
53
+
54
+ await user.click(checkbox);
55
+
56
+ expect(onToggle).toHaveBeenCalledTimes(1);
57
+ });
58
+
59
+ test("Passes checked state to onToggle", async () => {
60
+ const { user, onToggle } = setupTest({ checked: false });
61
+ const checkbox = screen.getByRole("checkbox");
62
+
63
+ await user.click(checkbox);
64
+
65
+ // After clicking, checkbox becomes checked (true)
66
+ expect(onToggle).toHaveBeenCalledWith(true);
67
+ });
68
+
69
+ test("Has full width container", () => {
70
+ const { container } = setupTest();
71
+ const wrapper = container.firstChild;
72
+ expect(wrapper).toHaveClass("w-full");
73
+ });
74
+
75
+ test("Uses flexbox layout", () => {
76
+ const { container } = setupTest();
77
+ const wrapper = container.firstChild;
78
+ expect(wrapper).toHaveClass("flex");
79
+ expect(wrapper).toHaveClass("items-center");
80
+ expect(wrapper).toHaveClass("justify-between");
81
+ });
82
+
83
+ test("Label has correct styling", () => {
84
+ setupTest({ label: "My Label" });
85
+ const label = screen.getByText("My Label");
86
+ expect(label).toHaveClass("text-sm");
87
+ expect(label).toHaveClass("font-medium");
88
+ expect(label).toHaveClass("text-gray-700");
89
+ });
90
+
91
+ test("Has pointer cursor on label", () => {
92
+ const { container } = setupTest();
93
+ const labelElement = container.querySelector("label");
94
+ expect(labelElement).toHaveClass("cursor-pointer");
95
+ });
96
+
97
+ test("Toggle track has correct base classes", () => {
98
+ const { container } = setupTest();
99
+ const track = container.querySelector(".bg-gray-200");
100
+ expect(track).toBeInTheDocument();
101
+ expect(track).toHaveClass("rounded-full");
102
+ expect(track).toHaveClass("w-11");
103
+ expect(track).toHaveClass("h-6");
104
+ });
105
+
106
+ test("Toggle knob has correct base classes", () => {
107
+ const { container } = setupTest();
108
+ const knob = container.querySelector(".bg-white");
109
+ expect(knob).toBeInTheDocument();
110
+ expect(knob).toHaveClass("rounded-full");
111
+ expect(knob).toHaveClass("w-5");
112
+ expect(knob).toHaveClass("h-5");
113
+ });
114
+
115
+ test("Updates visual state on toggle", async () => {
116
+ const { user, container, component } = setupTest({ checked: false });
117
+ const checkbox = screen.getByRole("checkbox");
118
+
119
+ // Initially unchecked
120
+ expect(checkbox).not.toBeChecked();
121
+
122
+ await user.click(checkbox);
123
+
124
+ // The component's checked state should update
125
+ expect(checkbox).toBeChecked();
126
+ });
127
+ });
@@ -1,167 +1,167 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render } from '@testing-library/svelte';
3
- import VenueInfo from './VenueInfo.svelte';
4
-
5
- // Mock the utils
6
- vi.mock('@/utils/utils', () => ({
7
- microphonePlaceholder: '/placeholder-mic.png',
8
- parseLocation: vi.fn((location) => {
9
- if (!location) return { street: '', cityStateZip: '' };
10
- const parts = location.split(',').map((s) => s.trim());
11
- if (parts.length >= 2) {
12
- return {
13
- street: parts[0],
14
- cityStateZip: parts.slice(1).join(', '),
15
- };
16
- }
17
- return { street: location, cityStateZip: '' };
18
- }),
19
- }));
20
-
21
- describe('VenueInfo Component', () => {
22
- const defaultProps = {
23
- name: 'Comedy Club',
24
- image: '/venue-image.jpg',
25
- location: '123 Main St, Los Angeles, CA 90001',
26
- };
27
-
28
- beforeEach(() => {
29
- vi.clearAllMocks();
30
- });
31
-
32
- it('renders the component', () => {
33
- const { container } = render(VenueInfo, { props: defaultProps });
34
- expect(container.querySelector('.venue-info')).toBeDefined();
35
- });
36
-
37
- it('renders the venue name', () => {
38
- const { container } = render(VenueInfo, { props: defaultProps });
39
- expect(container.querySelector('.venue-name').textContent).toBe('Comedy Club');
40
- });
41
-
42
- it('renders venue image with CDN URL for relative paths', () => {
43
- const { container } = render(VenueInfo, { props: defaultProps });
44
- const img = container.querySelector('.venue-image img');
45
- expect(img.src).toBe('https://moxy.sfo3.digitaloceanspaces.com/venue-image.jpg');
46
- });
47
-
48
- it('renders venue image directly for http URLs', () => {
49
- const props = { ...defaultProps, image: 'https://example.com/image.jpg' };
50
- const { container } = render(VenueInfo, { props });
51
- const img = container.querySelector('.venue-image img');
52
- expect(img.src).toBe('https://example.com/image.jpg');
53
- });
54
-
55
- it('uses placeholder when image is empty', () => {
56
- const props = { ...defaultProps, image: '' };
57
- const { container } = render(VenueInfo, { props });
58
- const img = container.querySelector('.venue-image img');
59
- expect(img.src).toContain('placeholder-mic.png');
60
- });
61
-
62
- it('uses placeholder when image is whitespace only', () => {
63
- const props = { ...defaultProps, image: ' ' };
64
- const { container } = render(VenueInfo, { props });
65
- const img = container.querySelector('.venue-image img');
66
- expect(img.src).toContain('placeholder-mic.png');
67
- });
68
-
69
- it('renders street address', () => {
70
- const { container } = render(VenueInfo, { props: defaultProps });
71
- const locations = container.querySelectorAll('.venue-location');
72
- expect(locations.length).toBeGreaterThan(0);
73
- expect(locations[0].textContent).toBe('123 Main St');
74
- });
75
-
76
- it('renders city state zip', () => {
77
- const { container } = render(VenueInfo, { props: defaultProps });
78
- const locations = container.querySelectorAll('.venue-location');
79
- expect(locations.length).toBe(2);
80
- expect(locations[1].textContent).toBe('Los Angeles, CA 90001');
81
- });
82
-
83
- it('handles empty location', () => {
84
- const props = { ...defaultProps, location: '' };
85
- const { container } = render(VenueInfo, { props });
86
- const locations = container.querySelectorAll('.venue-location');
87
- expect(locations.length).toBe(0);
88
- });
89
-
90
- it('handles null location', () => {
91
- const props = { ...defaultProps, location: null };
92
- const { container } = render(VenueInfo, { props });
93
- expect(container.querySelector('.venue-info')).toBeDefined();
94
- });
95
-
96
- it('handles undefined location', () => {
97
- const props = { ...defaultProps, location: undefined };
98
- const { container } = render(VenueInfo, { props });
99
- expect(container.querySelector('.venue-info')).toBeDefined();
100
- });
101
-
102
- it('sets image alt text to venue name', () => {
103
- const { container } = render(VenueInfo, { props: defaultProps });
104
- const img = container.querySelector('.venue-image img');
105
- expect(img.alt).toBe('Comedy Club');
106
- });
107
-
108
- it('renders with default size', () => {
109
- const { container } = render(VenueInfo, { props: defaultProps });
110
- expect(container.querySelector('.venue-info--small')).toBeNull();
111
- });
112
-
113
- it('renders with small size', () => {
114
- const props = { ...defaultProps, size: 'small' };
115
- const { container } = render(VenueInfo, { props });
116
- expect(container.querySelector('.venue-info--small')).toBeDefined();
117
- });
118
-
119
- it('renders venue-image container', () => {
120
- const { container } = render(VenueInfo, { props: defaultProps });
121
- expect(container.querySelector('.venue-image')).toBeDefined();
122
- });
123
-
124
- it('renders venue-details container', () => {
125
- const { container } = render(VenueInfo, { props: defaultProps });
126
- expect(container.querySelector('.venue-details')).toBeDefined();
127
- });
128
-
129
- it('handles empty name', () => {
130
- const props = { ...defaultProps, name: '' };
131
- const { container } = render(VenueInfo, { props });
132
- expect(container.querySelector('.venue-name').textContent).toBe('');
133
- });
134
-
135
- it('handles location with single part', () => {
136
- const props = { ...defaultProps, location: 'Los Angeles' };
137
- const { container } = render(VenueInfo, { props });
138
- const locations = container.querySelectorAll('.venue-location');
139
- expect(locations.length).toBeGreaterThan(0);
140
- });
141
-
142
- it('handles https image URLs', () => {
143
- const props = { ...defaultProps, image: 'https://secure.example.com/image.jpg' };
144
- const { container } = render(VenueInfo, { props });
145
- const img = container.querySelector('.venue-image img');
146
- expect(img.src).toBe('https://secure.example.com/image.jpg');
147
- });
148
-
149
- it('handles http image URLs', () => {
150
- const props = { ...defaultProps, image: 'http://example.com/image.jpg' };
151
- const { container } = render(VenueInfo, { props });
152
- const img = container.querySelector('.venue-image img');
153
- expect(img.src).toBe('http://example.com/image.jpg');
154
- });
155
-
156
- it('renders with very long name', () => {
157
- const props = { ...defaultProps, name: 'A Very Long Venue Name That Might Need To Be Truncated In The UI' };
158
- const { container } = render(VenueInfo, { props });
159
- expect(container.querySelector('.venue-name').textContent).toBe('A Very Long Venue Name That Might Need To Be Truncated In The UI');
160
- });
161
-
162
- it('renders with special characters in name', () => {
163
- const props = { ...defaultProps, name: "Joe's Comedy & Bar" };
164
- const { container } = render(VenueInfo, { props });
165
- expect(container.querySelector('.venue-name').textContent).toBe("Joe's Comedy & Bar");
166
- });
167
- });
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import { render } from '@testing-library/svelte';
3
+ import VenueInfo from './VenueInfo.svelte';
4
+
5
+ // Mock the utils
6
+ vi.mock('@/utils/utils', () => ({
7
+ microphonePlaceholder: '/placeholder-mic.png',
8
+ parseLocation: vi.fn((location) => {
9
+ if (!location) return { street: '', cityStateZip: '' };
10
+ const parts = location.split(',').map((s) => s.trim());
11
+ if (parts.length >= 2) {
12
+ return {
13
+ street: parts[0],
14
+ cityStateZip: parts.slice(1).join(', '),
15
+ };
16
+ }
17
+ return { street: location, cityStateZip: '' };
18
+ }),
19
+ }));
20
+
21
+ describe('VenueInfo Component', () => {
22
+ const defaultProps = {
23
+ name: 'Comedy Club',
24
+ image: '/venue-image.jpg',
25
+ location: '123 Main St, Los Angeles, CA 90001',
26
+ };
27
+
28
+ beforeEach(() => {
29
+ vi.clearAllMocks();
30
+ });
31
+
32
+ it('renders the component', () => {
33
+ const { container } = render(VenueInfo, { props: defaultProps });
34
+ expect(container.querySelector('.venue-info')).toBeDefined();
35
+ });
36
+
37
+ it('renders the venue name', () => {
38
+ const { container } = render(VenueInfo, { props: defaultProps });
39
+ expect(container.querySelector('.venue-name').textContent).toBe('Comedy Club');
40
+ });
41
+
42
+ it('renders venue image with CDN URL for relative paths', () => {
43
+ const { container } = render(VenueInfo, { props: defaultProps });
44
+ const img = container.querySelector('.venue-image img');
45
+ expect(img.src).toBe('https://moxy.sfo3.digitaloceanspaces.com/venue-image.jpg');
46
+ });
47
+
48
+ it('renders venue image directly for http URLs', () => {
49
+ const props = { ...defaultProps, image: 'https://example.com/image.jpg' };
50
+ const { container } = render(VenueInfo, { props });
51
+ const img = container.querySelector('.venue-image img');
52
+ expect(img.src).toBe('https://example.com/image.jpg');
53
+ });
54
+
55
+ it('uses placeholder when image is empty', () => {
56
+ const props = { ...defaultProps, image: '' };
57
+ const { container } = render(VenueInfo, { props });
58
+ const img = container.querySelector('.venue-image img');
59
+ expect(img.src).toContain('placeholder-mic.png');
60
+ });
61
+
62
+ it('uses placeholder when image is whitespace only', () => {
63
+ const props = { ...defaultProps, image: ' ' };
64
+ const { container } = render(VenueInfo, { props });
65
+ const img = container.querySelector('.venue-image img');
66
+ expect(img.src).toContain('placeholder-mic.png');
67
+ });
68
+
69
+ it('renders street address', () => {
70
+ const { container } = render(VenueInfo, { props: defaultProps });
71
+ const locations = container.querySelectorAll('.venue-location');
72
+ expect(locations.length).toBeGreaterThan(0);
73
+ expect(locations[0].textContent).toBe('123 Main St');
74
+ });
75
+
76
+ it('renders city state zip', () => {
77
+ const { container } = render(VenueInfo, { props: defaultProps });
78
+ const locations = container.querySelectorAll('.venue-location');
79
+ expect(locations.length).toBe(2);
80
+ expect(locations[1].textContent).toBe('Los Angeles, CA 90001');
81
+ });
82
+
83
+ it('handles empty location', () => {
84
+ const props = { ...defaultProps, location: '' };
85
+ const { container } = render(VenueInfo, { props });
86
+ const locations = container.querySelectorAll('.venue-location');
87
+ expect(locations.length).toBe(0);
88
+ });
89
+
90
+ it('handles null location', () => {
91
+ const props = { ...defaultProps, location: null };
92
+ const { container } = render(VenueInfo, { props });
93
+ expect(container.querySelector('.venue-info')).toBeDefined();
94
+ });
95
+
96
+ it('handles undefined location', () => {
97
+ const props = { ...defaultProps, location: undefined };
98
+ const { container } = render(VenueInfo, { props });
99
+ expect(container.querySelector('.venue-info')).toBeDefined();
100
+ });
101
+
102
+ it('sets image alt text to venue name', () => {
103
+ const { container } = render(VenueInfo, { props: defaultProps });
104
+ const img = container.querySelector('.venue-image img');
105
+ expect(img.alt).toBe('Comedy Club');
106
+ });
107
+
108
+ it('renders with default size', () => {
109
+ const { container } = render(VenueInfo, { props: defaultProps });
110
+ expect(container.querySelector('.venue-info--small')).toBeNull();
111
+ });
112
+
113
+ it('renders with small size', () => {
114
+ const props = { ...defaultProps, size: 'small' };
115
+ const { container } = render(VenueInfo, { props });
116
+ expect(container.querySelector('.venue-info--small')).toBeDefined();
117
+ });
118
+
119
+ it('renders venue-image container', () => {
120
+ const { container } = render(VenueInfo, { props: defaultProps });
121
+ expect(container.querySelector('.venue-image')).toBeDefined();
122
+ });
123
+
124
+ it('renders venue-details container', () => {
125
+ const { container } = render(VenueInfo, { props: defaultProps });
126
+ expect(container.querySelector('.venue-details')).toBeDefined();
127
+ });
128
+
129
+ it('handles empty name', () => {
130
+ const props = { ...defaultProps, name: '' };
131
+ const { container } = render(VenueInfo, { props });
132
+ expect(container.querySelector('.venue-name').textContent).toBe('');
133
+ });
134
+
135
+ it('handles location with single part', () => {
136
+ const props = { ...defaultProps, location: 'Los Angeles' };
137
+ const { container } = render(VenueInfo, { props });
138
+ const locations = container.querySelectorAll('.venue-location');
139
+ expect(locations.length).toBeGreaterThan(0);
140
+ });
141
+
142
+ it('handles https image URLs', () => {
143
+ const props = { ...defaultProps, image: 'https://secure.example.com/image.jpg' };
144
+ const { container } = render(VenueInfo, { props });
145
+ const img = container.querySelector('.venue-image img');
146
+ expect(img.src).toBe('https://secure.example.com/image.jpg');
147
+ });
148
+
149
+ it('handles http image URLs', () => {
150
+ const props = { ...defaultProps, image: 'http://example.com/image.jpg' };
151
+ const { container } = render(VenueInfo, { props });
152
+ const img = container.querySelector('.venue-image img');
153
+ expect(img.src).toBe('http://example.com/image.jpg');
154
+ });
155
+
156
+ it('renders with very long name', () => {
157
+ const props = { ...defaultProps, name: 'A Very Long Venue Name That Might Need To Be Truncated In The UI' };
158
+ const { container } = render(VenueInfo, { props });
159
+ expect(container.querySelector('.venue-name').textContent).toBe('A Very Long Venue Name That Might Need To Be Truncated In The UI');
160
+ });
161
+
162
+ it('renders with special characters in name', () => {
163
+ const props = { ...defaultProps, name: "Joe's Comedy & Bar" };
164
+ const { container } = render(VenueInfo, { props });
165
+ expect(container.querySelector('.venue-name').textContent).toBe("Joe's Comedy & Bar");
166
+ });
167
+ });