@getmicdrop/svelte-components 1.0.1 → 1.0.2
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/README.md +98 -98
- package/dist/config.js +5 -5
- package/dist/config.spec.js +29 -29
- package/dist/constants/formOptions.js +25 -25
- package/dist/constants/formOptions.spec.js +88 -88
- package/dist/telemetry.js +357 -357
- package/dist/telemetry.server.js +211 -211
- package/dist/telemetry.server.spec.js +434 -434
- package/dist/telemetry.spec.js +660 -660
- package/package.json +152 -152
package/README.md
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
# @micdrop/components
|
|
2
|
-
|
|
3
|
-
Shared component library for Micdrop applications.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @micdrop/components
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```svelte
|
|
14
|
-
<script>
|
|
15
|
-
import { Button, Input, Modal } from '@micdrop/components';
|
|
16
|
-
import '@micdrop/components/styles';
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<Button variant="primary">Click me</Button>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Development
|
|
23
|
-
|
|
24
|
-
### Install dependencies
|
|
25
|
-
```bash
|
|
26
|
-
npm install
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Run Storybook
|
|
30
|
-
```bash
|
|
31
|
-
npm run storybook
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Run tests
|
|
35
|
-
```bash
|
|
36
|
-
npm test
|
|
37
|
-
npm run test:watch # Watch mode
|
|
38
|
-
npm run test:ui # UI mode
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Build
|
|
42
|
-
```bash
|
|
43
|
-
npm run build
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Components
|
|
47
|
-
|
|
48
|
-
### Core UI Components
|
|
49
|
-
- **Alert** - Alert notifications
|
|
50
|
-
- **Badge** - Badge display
|
|
51
|
-
- **Breadcrumb** - Navigation breadcrumb
|
|
52
|
-
- **Button** - Primary button with variants
|
|
53
|
-
- **Card** - Card container
|
|
54
|
-
- **Spinner** - Loading spinner
|
|
55
|
-
- **Toaster** - Toast notifications
|
|
56
|
-
|
|
57
|
-
### Form Components
|
|
58
|
-
- **Input** - Text input with validation
|
|
59
|
-
- **Select** - Dropdown select
|
|
60
|
-
- **MultiSelect** - Multi-select dropdown
|
|
61
|
-
- **GenderInput** - Gender selector
|
|
62
|
-
- **EthnicityDropdown** - Ethnicity selector
|
|
63
|
-
- **PlaceAutocomplete** - Google Places autocomplete
|
|
64
|
-
- **CropImage** - Image cropping utility
|
|
65
|
-
|
|
66
|
-
### Layout Components
|
|
67
|
-
- **Header** - Application header
|
|
68
|
-
- **Sidebar** - Navigation sidebar
|
|
69
|
-
- **Modal** - Modal dialog
|
|
70
|
-
- **ConfirmationModal** - Confirmation modal
|
|
71
|
-
|
|
72
|
-
### Calendar Components
|
|
73
|
-
- **QuarterView** - Calendar quarter view
|
|
74
|
-
|
|
75
|
-
### Icon Components
|
|
76
|
-
- 26 icon components available in `Icons/` directory
|
|
77
|
-
|
|
78
|
-
### Page Components
|
|
79
|
-
Located in `pages/` directory:
|
|
80
|
-
- **performers/** - Performer-related components
|
|
81
|
-
- **profile/** - Profile components
|
|
82
|
-
- **settings/** - Settings components
|
|
83
|
-
- **shows/** - Show/event components
|
|
84
|
-
|
|
85
|
-
## Testing
|
|
86
|
-
|
|
87
|
-
All components include:
|
|
88
|
-
- Unit tests using Vitest
|
|
89
|
-
- Storybook stories for visual testing
|
|
90
|
-
- Type definitions
|
|
91
|
-
|
|
92
|
-
## Version History
|
|
93
|
-
|
|
94
|
-
### 1.0.0 (Upcoming)
|
|
95
|
-
- Initial release
|
|
96
|
-
- Core components from performersportal
|
|
97
|
-
- Full test coverage
|
|
98
|
-
- Storybook documentation
|
|
1
|
+
# @micdrop/components
|
|
2
|
+
|
|
3
|
+
Shared component library for Micdrop applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @micdrop/components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```svelte
|
|
14
|
+
<script>
|
|
15
|
+
import { Button, Input, Modal } from '@micdrop/components';
|
|
16
|
+
import '@micdrop/components/styles';
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Button variant="primary">Click me</Button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
|
|
24
|
+
### Install dependencies
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Run Storybook
|
|
30
|
+
```bash
|
|
31
|
+
npm run storybook
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Run tests
|
|
35
|
+
```bash
|
|
36
|
+
npm test
|
|
37
|
+
npm run test:watch # Watch mode
|
|
38
|
+
npm run test:ui # UI mode
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Build
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Components
|
|
47
|
+
|
|
48
|
+
### Core UI Components
|
|
49
|
+
- **Alert** - Alert notifications
|
|
50
|
+
- **Badge** - Badge display
|
|
51
|
+
- **Breadcrumb** - Navigation breadcrumb
|
|
52
|
+
- **Button** - Primary button with variants
|
|
53
|
+
- **Card** - Card container
|
|
54
|
+
- **Spinner** - Loading spinner
|
|
55
|
+
- **Toaster** - Toast notifications
|
|
56
|
+
|
|
57
|
+
### Form Components
|
|
58
|
+
- **Input** - Text input with validation
|
|
59
|
+
- **Select** - Dropdown select
|
|
60
|
+
- **MultiSelect** - Multi-select dropdown
|
|
61
|
+
- **GenderInput** - Gender selector
|
|
62
|
+
- **EthnicityDropdown** - Ethnicity selector
|
|
63
|
+
- **PlaceAutocomplete** - Google Places autocomplete
|
|
64
|
+
- **CropImage** - Image cropping utility
|
|
65
|
+
|
|
66
|
+
### Layout Components
|
|
67
|
+
- **Header** - Application header
|
|
68
|
+
- **Sidebar** - Navigation sidebar
|
|
69
|
+
- **Modal** - Modal dialog
|
|
70
|
+
- **ConfirmationModal** - Confirmation modal
|
|
71
|
+
|
|
72
|
+
### Calendar Components
|
|
73
|
+
- **QuarterView** - Calendar quarter view
|
|
74
|
+
|
|
75
|
+
### Icon Components
|
|
76
|
+
- 26 icon components available in `Icons/` directory
|
|
77
|
+
|
|
78
|
+
### Page Components
|
|
79
|
+
Located in `pages/` directory:
|
|
80
|
+
- **performers/** - Performer-related components
|
|
81
|
+
- **profile/** - Profile components
|
|
82
|
+
- **settings/** - Settings components
|
|
83
|
+
- **shows/** - Show/event components
|
|
84
|
+
|
|
85
|
+
## Testing
|
|
86
|
+
|
|
87
|
+
All components include:
|
|
88
|
+
- Unit tests using Vitest
|
|
89
|
+
- Storybook stories for visual testing
|
|
90
|
+
- Type definitions
|
|
91
|
+
|
|
92
|
+
## Version History
|
|
93
|
+
|
|
94
|
+
### 1.0.0 (Upcoming)
|
|
95
|
+
- Initial release
|
|
96
|
+
- Core components from performersportal
|
|
97
|
+
- Full test coverage
|
|
98
|
+
- Storybook documentation
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const API_BASE_URL =
|
|
2
|
-
import.meta.env.VITE_API_BASE_URL || 'https://get-micdrop.com';
|
|
3
|
-
|
|
4
|
-
export const PUBLIC_GOOGLE_MAPS_API_KEY =
|
|
5
|
-
import.meta.env.VITE_PUBLIC_GOOGLE_MAPS_API_KEY ||
|
|
1
|
+
export const API_BASE_URL =
|
|
2
|
+
import.meta.env.VITE_API_BASE_URL || 'https://get-micdrop.com';
|
|
3
|
+
|
|
4
|
+
export const PUBLIC_GOOGLE_MAPS_API_KEY =
|
|
5
|
+
import.meta.env.VITE_PUBLIC_GOOGLE_MAPS_API_KEY ||
|
|
6
6
|
'AIzaSyCFB0-9qay7P0jZZDw93SsTnyLtZDlch7Q';
|
package/dist/config.spec.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
|
|
3
|
-
describe('config.js', () => {
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
vi.resetModules();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
it('exports API_BASE_URL', async () => {
|
|
9
|
-
const config = await import('./config.js');
|
|
10
|
-
expect(config.API_BASE_URL).toBeDefined();
|
|
11
|
-
expect(typeof config.API_BASE_URL).toBe('string');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('exports PUBLIC_GOOGLE_MAPS_API_KEY', async () => {
|
|
15
|
-
const config = await import('./config.js');
|
|
16
|
-
expect(config.PUBLIC_GOOGLE_MAPS_API_KEY).toBeDefined();
|
|
17
|
-
expect(typeof config.PUBLIC_GOOGLE_MAPS_API_KEY).toBe('string');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('uses default API_BASE_URL when env var not set', async () => {
|
|
21
|
-
const config = await import('./config.js');
|
|
22
|
-
expect(config.API_BASE_URL).toContain('get-micdrop.com');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('uses default Google Maps key when env var not set', async () => {
|
|
26
|
-
const config = await import('./config.js');
|
|
27
|
-
expect(config.PUBLIC_GOOGLE_MAPS_API_KEY).toContain('AIzaSy');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
3
|
+
describe('config.js', () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
vi.resetModules();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('exports API_BASE_URL', async () => {
|
|
9
|
+
const config = await import('./config.js');
|
|
10
|
+
expect(config.API_BASE_URL).toBeDefined();
|
|
11
|
+
expect(typeof config.API_BASE_URL).toBe('string');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('exports PUBLIC_GOOGLE_MAPS_API_KEY', async () => {
|
|
15
|
+
const config = await import('./config.js');
|
|
16
|
+
expect(config.PUBLIC_GOOGLE_MAPS_API_KEY).toBeDefined();
|
|
17
|
+
expect(typeof config.PUBLIC_GOOGLE_MAPS_API_KEY).toBe('string');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('uses default API_BASE_URL when env var not set', async () => {
|
|
21
|
+
const config = await import('./config.js');
|
|
22
|
+
expect(config.API_BASE_URL).toContain('get-micdrop.com');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('uses default Google Maps key when env var not set', async () => {
|
|
26
|
+
const config = await import('./config.js');
|
|
27
|
+
expect(config.PUBLIC_GOOGLE_MAPS_API_KEY).toContain('AIzaSy');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form options for dropdowns used across the performers portal.
|
|
3
|
-
* Use these with Select and MultiSelect components instead of
|
|
4
|
-
* creating wrapper components like GenderInput or EthnicityDropdown.
|
|
5
|
-
*
|
|
6
|
-
* Example:
|
|
7
|
-
* import { GENDER_OPTIONS } from './formOptions';
|
|
8
|
-
* <Select items={GENDER_OPTIONS} label="Gender" />
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export const GENDER_OPTIONS = [
|
|
12
|
-
{ name: "Male", value: 1 },
|
|
13
|
-
{ name: "Female", value: 2 },
|
|
14
|
-
{ name: "Non-Binary", value: 3 },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
export const ETHNICITY_OPTIONS = [
|
|
18
|
-
{ name: "American Indian or Alaska Native", value: 0 },
|
|
19
|
-
{ name: "Asian", value: 1 },
|
|
20
|
-
{ name: "Black or African American", value: 2 },
|
|
21
|
-
{ name: "Hispanic or Latino", value: 3 },
|
|
22
|
-
{ name: "Middle Eastern or North African", value: 4 },
|
|
23
|
-
{ name: "Native Hawaiian or Pacific Islander", value: 5 },
|
|
24
|
-
{ name: "White", value: 6 },
|
|
25
|
-
];
|
|
1
|
+
/**
|
|
2
|
+
* Form options for dropdowns used across the performers portal.
|
|
3
|
+
* Use these with Select and MultiSelect components instead of
|
|
4
|
+
* creating wrapper components like GenderInput or EthnicityDropdown.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* import { GENDER_OPTIONS } from './formOptions';
|
|
8
|
+
* <Select items={GENDER_OPTIONS} label="Gender" />
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const GENDER_OPTIONS = [
|
|
12
|
+
{ name: "Male", value: 1 },
|
|
13
|
+
{ name: "Female", value: 2 },
|
|
14
|
+
{ name: "Non-Binary", value: 3 },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const ETHNICITY_OPTIONS = [
|
|
18
|
+
{ name: "American Indian or Alaska Native", value: 0 },
|
|
19
|
+
{ name: "Asian", value: 1 },
|
|
20
|
+
{ name: "Black or African American", value: 2 },
|
|
21
|
+
{ name: "Hispanic or Latino", value: 3 },
|
|
22
|
+
{ name: "Middle Eastern or North African", value: 4 },
|
|
23
|
+
{ name: "Native Hawaiian or Pacific Islander", value: 5 },
|
|
24
|
+
{ name: "White", value: 6 },
|
|
25
|
+
];
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { GENDER_OPTIONS, ETHNICITY_OPTIONS } from './formOptions.js';
|
|
3
|
-
|
|
4
|
-
describe('formOptions', () => {
|
|
5
|
-
describe('GENDER_OPTIONS', () => {
|
|
6
|
-
it('exports gender options array', () => {
|
|
7
|
-
expect(GENDER_OPTIONS).toBeDefined();
|
|
8
|
-
expect(Array.isArray(GENDER_OPTIONS)).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('has three options', () => {
|
|
12
|
-
expect(GENDER_OPTIONS.length).toBe(3);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('contains Male option with value 1', () => {
|
|
16
|
-
const male = GENDER_OPTIONS.find(opt => opt.name === 'Male');
|
|
17
|
-
expect(male).toBeDefined();
|
|
18
|
-
expect(male.value).toBe(1);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('contains Female option with value 2', () => {
|
|
22
|
-
const female = GENDER_OPTIONS.find(opt => opt.name === 'Female');
|
|
23
|
-
expect(female).toBeDefined();
|
|
24
|
-
expect(female.value).toBe(2);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('contains Non-Binary option with value 3', () => {
|
|
28
|
-
const nonBinary = GENDER_OPTIONS.find(opt => opt.name === 'Non-Binary');
|
|
29
|
-
expect(nonBinary).toBeDefined();
|
|
30
|
-
expect(nonBinary.value).toBe(3);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('each option has name and value properties', () => {
|
|
34
|
-
GENDER_OPTIONS.forEach(option => {
|
|
35
|
-
expect(option).toHaveProperty('name');
|
|
36
|
-
expect(option).toHaveProperty('value');
|
|
37
|
-
expect(typeof option.name).toBe('string');
|
|
38
|
-
expect(typeof option.value).toBe('number');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('ETHNICITY_OPTIONS', () => {
|
|
44
|
-
it('exports ethnicity options array', () => {
|
|
45
|
-
expect(ETHNICITY_OPTIONS).toBeDefined();
|
|
46
|
-
expect(Array.isArray(ETHNICITY_OPTIONS)).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('has seven options', () => {
|
|
50
|
-
expect(ETHNICITY_OPTIONS.length).toBe(7);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('contains all expected ethnicities', () => {
|
|
54
|
-
const names = ETHNICITY_OPTIONS.map(opt => opt.name);
|
|
55
|
-
expect(names).toContain('American Indian or Alaska Native');
|
|
56
|
-
expect(names).toContain('Asian');
|
|
57
|
-
expect(names).toContain('Black or African American');
|
|
58
|
-
expect(names).toContain('Hispanic or Latino');
|
|
59
|
-
expect(names).toContain('Middle Eastern or North African');
|
|
60
|
-
expect(names).toContain('Native Hawaiian or Pacific Islander');
|
|
61
|
-
expect(names).toContain('White');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('has values 0 through 6', () => {
|
|
65
|
-
const values = ETHNICITY_OPTIONS.map(opt => opt.value).sort((a, b) => a - b);
|
|
66
|
-
expect(values).toEqual([0, 1, 2, 3, 4, 5, 6]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('each option has name and value properties', () => {
|
|
70
|
-
ETHNICITY_OPTIONS.forEach(option => {
|
|
71
|
-
expect(option).toHaveProperty('name');
|
|
72
|
-
expect(option).toHaveProperty('value');
|
|
73
|
-
expect(typeof option.name).toBe('string');
|
|
74
|
-
expect(typeof option.value).toBe('number');
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('American Indian or Alaska Native has value 0', () => {
|
|
79
|
-
const option = ETHNICITY_OPTIONS.find(opt => opt.name === 'American Indian or Alaska Native');
|
|
80
|
-
expect(option.value).toBe(0);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('White has value 6', () => {
|
|
84
|
-
const option = ETHNICITY_OPTIONS.find(opt => opt.name === 'White');
|
|
85
|
-
expect(option.value).toBe(6);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { GENDER_OPTIONS, ETHNICITY_OPTIONS } from './formOptions.js';
|
|
3
|
+
|
|
4
|
+
describe('formOptions', () => {
|
|
5
|
+
describe('GENDER_OPTIONS', () => {
|
|
6
|
+
it('exports gender options array', () => {
|
|
7
|
+
expect(GENDER_OPTIONS).toBeDefined();
|
|
8
|
+
expect(Array.isArray(GENDER_OPTIONS)).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('has three options', () => {
|
|
12
|
+
expect(GENDER_OPTIONS.length).toBe(3);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('contains Male option with value 1', () => {
|
|
16
|
+
const male = GENDER_OPTIONS.find(opt => opt.name === 'Male');
|
|
17
|
+
expect(male).toBeDefined();
|
|
18
|
+
expect(male.value).toBe(1);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('contains Female option with value 2', () => {
|
|
22
|
+
const female = GENDER_OPTIONS.find(opt => opt.name === 'Female');
|
|
23
|
+
expect(female).toBeDefined();
|
|
24
|
+
expect(female.value).toBe(2);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('contains Non-Binary option with value 3', () => {
|
|
28
|
+
const nonBinary = GENDER_OPTIONS.find(opt => opt.name === 'Non-Binary');
|
|
29
|
+
expect(nonBinary).toBeDefined();
|
|
30
|
+
expect(nonBinary.value).toBe(3);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('each option has name and value properties', () => {
|
|
34
|
+
GENDER_OPTIONS.forEach(option => {
|
|
35
|
+
expect(option).toHaveProperty('name');
|
|
36
|
+
expect(option).toHaveProperty('value');
|
|
37
|
+
expect(typeof option.name).toBe('string');
|
|
38
|
+
expect(typeof option.value).toBe('number');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('ETHNICITY_OPTIONS', () => {
|
|
44
|
+
it('exports ethnicity options array', () => {
|
|
45
|
+
expect(ETHNICITY_OPTIONS).toBeDefined();
|
|
46
|
+
expect(Array.isArray(ETHNICITY_OPTIONS)).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('has seven options', () => {
|
|
50
|
+
expect(ETHNICITY_OPTIONS.length).toBe(7);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('contains all expected ethnicities', () => {
|
|
54
|
+
const names = ETHNICITY_OPTIONS.map(opt => opt.name);
|
|
55
|
+
expect(names).toContain('American Indian or Alaska Native');
|
|
56
|
+
expect(names).toContain('Asian');
|
|
57
|
+
expect(names).toContain('Black or African American');
|
|
58
|
+
expect(names).toContain('Hispanic or Latino');
|
|
59
|
+
expect(names).toContain('Middle Eastern or North African');
|
|
60
|
+
expect(names).toContain('Native Hawaiian or Pacific Islander');
|
|
61
|
+
expect(names).toContain('White');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('has values 0 through 6', () => {
|
|
65
|
+
const values = ETHNICITY_OPTIONS.map(opt => opt.value).sort((a, b) => a - b);
|
|
66
|
+
expect(values).toEqual([0, 1, 2, 3, 4, 5, 6]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('each option has name and value properties', () => {
|
|
70
|
+
ETHNICITY_OPTIONS.forEach(option => {
|
|
71
|
+
expect(option).toHaveProperty('name');
|
|
72
|
+
expect(option).toHaveProperty('value');
|
|
73
|
+
expect(typeof option.name).toBe('string');
|
|
74
|
+
expect(typeof option.value).toBe('number');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('American Indian or Alaska Native has value 0', () => {
|
|
79
|
+
const option = ETHNICITY_OPTIONS.find(opt => opt.name === 'American Indian or Alaska Native');
|
|
80
|
+
expect(option.value).toBe(0);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('White has value 6', () => {
|
|
84
|
+
const option = ETHNICITY_OPTIONS.find(opt => opt.name === 'White');
|
|
85
|
+
expect(option.value).toBe(6);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|