Skip to content

Commit dd9c413

Browse files
updating tests
1 parent 8346294 commit dd9c413

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

cypress/templates/testData.ts

+47
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,52 @@ import {
77
import { useDeepMerge } from '../../src/plugin/composables/helpers';
88

99

10+
const stepperProps = {
11+
altLabels: true,
12+
autoPage: true,
13+
autoPageDelay: 3000,
14+
bgColor: 'secondary',
15+
border: 'lg',
16+
color: 'primary',
17+
density: 'default' as const,
18+
disabled: false,
19+
editIcon: 'fas fa-pencil',
20+
editable: false,
21+
elevation: 10,
22+
errorIcon: 'fas fa-cog',
23+
fieldColumns: {
24+
lg: 12,
25+
md: 12,
26+
sm: 12,
27+
xl: 12,
28+
},
29+
flat: true,
30+
headerTooltips: true,
31+
height: '900px',
32+
hideActions: true,
33+
hideDetails: true,
34+
keepValuesOnUnmount: false,
35+
maxHeight: '50px',
36+
maxWidth: '50px',
37+
minHeight: '900px',
38+
minWidth: '900px',
39+
nextText: 'hop forward',
40+
prevText: 'hop backwards',
41+
rounded: 'pill',
42+
selectedClass: 'bunnies',
43+
summaryColumns: { sm: 6 },
44+
tag: 'div',
45+
theme: 'light',
46+
tile: true,
47+
tooltipLocation: 'end' as const,
48+
tooltipOffset: 10,
49+
tooltipTransition: 'fade-transition',
50+
transition: 'fade-transition',
51+
validateOn: 'blur' as const,
52+
validateOnMount: true,
53+
variant: 'outlined',
54+
};
55+
1056
const answers = {
1157
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Page 1 //
1258
firstName: null,
@@ -303,5 +349,6 @@ export {
303349
buttonFieldOptions,
304350
finalAnswer,
305351
items,
352+
stepperProps,
306353
validationSchema,
307354
};

src/plugin/composables/__tests__/helpers.spec.cy.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
import {
2+
useBuildSettings,
23
useColumnErrorCheck,
34
useDeepMerge,
45
} from '../helpers';
6+
import * as DATA from '../../../../cypress/templates/testData';
7+
58

69
describe('Helpers Composable', () => {
710

11+
describe('useBuildSettings', () => {
12+
it('should return the correct settings object', () => {
13+
const stepperProps = DATA.stepperProps;
14+
15+
const result = useBuildSettings(stepperProps);
16+
17+
expect(result).to.deep.equal(stepperProps);
18+
});
19+
20+
it('should return the incorrect settings object', () => {
21+
const stepperProps = DATA.stepperProps;
22+
23+
const result = useBuildSettings(stepperProps);
24+
25+
expect(result).to.not.deep.equal({
26+
...stepperProps,
27+
bunnies: 'fluffy',
28+
});
29+
});
30+
});
31+
832
describe('useColumnErrorCheck', () => {
933
describe('Errors', () => {
1034
const propName = 'columns';

src/plugin/composables/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
*/
1313
type AnyObject = Record<string, any>;
1414

15-
export const useDeepMerge: UseDeepMerge = (A, B, C) => {
15+
export const useDeepMerge: UseDeepMerge = (A, B, C = {}) => {
1616
const deepMerge = (obj1: AnyObject, obj2: AnyObject): AnyObject => {
1717
const result: AnyObject = { ...obj1 };
1818
for (const key in obj2) {

src/plugin/types/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export interface UseDeepMerge {
258258
(
259259
A: Record<string, any>,
260260
B: Record<string, any>,
261-
C: Record<string, any>
261+
C?: Record<string, any>
262262
): Record<string, any>;
263263
}
264264

0 commit comments

Comments
 (0)