Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add integration tests on expandable calendar #2081

Merged
merged 4 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"./jest-setup.js"
],
"testMatch": [
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx}"
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts}"
],
"transformIgnorePatterns": [
"node_modules/(?!(@react-native|react-native|react-native-swipe-gestures)/)"
Expand Down
2 changes: 1 addition & 1 deletion src/expandableCalendar/WeekCalendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {extractCalendarProps} from '../../componentUpdater';
import CalendarContext from '../Context';
import {useDidUpdate} from '../../hooks';

const NUMBER_OF_PAGES = 6;
export const NUMBER_OF_PAGES = 6;
const NUM_OF_ITEMS = NUMBER_OF_PAGES * 2 + 1; // NUMBER_OF_PAGES before + NUMBER_OF_PAGES after + current
const APPLY_ANDROID_FIX = constants.isAndroid && constants.isRTL;

Expand Down
41 changes: 41 additions & 0 deletions src/expandableCalendar/__test__/expandableCalendarTestKit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import {
CalendarContextProviderProps,
CalendarProvider,
ExpandableCalendar,
ExpandableCalendarProps
} from 'react-native-calendars';
import {toMarkingFormat} from '../../interface';

const XDate = require('xdate');

const today = new XDate();
export const testIdExpandableCalendar = 'myExpandableCalendar';

export const expandableCalendarTestIDs = (testId: string) => {
Inbal-Tish marked this conversation as resolved.
Show resolved Hide resolved
return {
leftArrow: `${testId}.leftArrow`,
rightArrow: `${testId}.rightArrow`,
};
};
export const generateExpandableCalendarWithContext = ({
expandableCalendarProps,
calendarContextProps,
}: {
expandableCalendarProps?: Partial<ExpandableCalendarProps>;
calendarContextProps?: Partial<CalendarContextProviderProps>;
} = {}) => {
const defaultContextProps: CalendarContextProviderProps = {
date: toMarkingFormat(today),
showTodayButton: true,
};
const defaultExpandableCalendarProps: ExpandableCalendarProps = {
testID: testIdExpandableCalendar,
};

return (
<CalendarProvider {...defaultContextProps} {...calendarContextProps}>
<ExpandableCalendar {...defaultExpandableCalendarProps} {...expandableCalendarProps}/>
</CalendarProvider>
);
};
135 changes: 0 additions & 135 deletions src/expandableCalendar/__test__/index.spec.js

This file was deleted.