Compare commits
3 Commits
e308216226
...
6c794872f5
Author | SHA1 | Date |
---|---|---|
Lee | 6c794872f5 | |
Lee | 39d5e64078 | |
Lee | fced5b0abb |
|
@ -0,0 +1,107 @@
|
|||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import {useRoute} from '@react-navigation/native';
|
||||
import {useUser} from '../../libs/hooks/src';
|
||||
import {fireEvent, waitFor} from '@testing-library/react-native';
|
||||
import Mockdate from 'mockdate';
|
||||
import React from 'react';
|
||||
import {useSMS} from '../../utils/SMS';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import Absence from '../absence.component';
|
||||
|
||||
let sendSMS;
|
||||
let user = {personalNumber: '201701092395'};
|
||||
|
||||
jest.mock('../../utils/SMS');
|
||||
jest.mock('../../libs/hooks/src');
|
||||
|
||||
const setup = (customProps = {}) => {
|
||||
sendSMS = jest.fn();
|
||||
|
||||
useSMS.mockReturnValue({sendSMS});
|
||||
useRoute.mockReturnValue({params: {child: {id: '1'}}});
|
||||
|
||||
const props = {
|
||||
...customProps,
|
||||
};
|
||||
|
||||
return render(<Absence {...props} />);
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
// Hide errors from act
|
||||
// https://github.com/callstack/react-native-testing-library/issues/379
|
||||
jest.spyOn(console, 'error').mockImplementation(() => {
|
||||
// noop
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks();
|
||||
useUser.mockReturnValue({
|
||||
data: user,
|
||||
status: 'loaded',
|
||||
});
|
||||
await AsyncStorage.clear();
|
||||
});
|
||||
|
||||
test.skip('can fill out the form with full day absence', async () => {
|
||||
const screen = setup();
|
||||
|
||||
await waitFor(() =>
|
||||
fireEvent.changeText(
|
||||
screen.getByTestId('personalIdentityNumberInput'),
|
||||
'1212121212',
|
||||
),
|
||||
);
|
||||
await waitFor(() => fireEvent.press(screen.getByText('Skicka')));
|
||||
|
||||
expect(screen.queryByText(/starttid/i)).toBeFalsy();
|
||||
expect(screen.queryByText(/sluttid/i)).toBeFalsy();
|
||||
|
||||
expect(sendSMS).toHaveBeenCalledWith('121212-1212');
|
||||
});
|
||||
|
||||
test.skip('handles missing social security number', async () => {
|
||||
const screen = setup();
|
||||
|
||||
await waitFor(() => fireEvent.press(screen.getByText('Skicka')));
|
||||
|
||||
expect(screen.getByText(/Personnummer saknas/i)).toBeTruthy();
|
||||
expect(sendSMS).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.skip('validates social security number', async () => {
|
||||
const screen = setup();
|
||||
|
||||
await waitFor(() =>
|
||||
fireEvent.changeText(
|
||||
screen.getByTestId('personalIdentityNumberInput'),
|
||||
'12121212',
|
||||
),
|
||||
);
|
||||
await waitFor(() => fireEvent.press(screen.getByText('Skicka')));
|
||||
|
||||
expect(screen.getByText(/Personnumret är ogiltigt/i)).toBeTruthy();
|
||||
expect(sendSMS).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.skip('can fill out the form with part of day absence', async () => {
|
||||
Mockdate.set('2021-02-18 15:30');
|
||||
|
||||
const screen = setup();
|
||||
|
||||
await waitFor(() =>
|
||||
fireEvent.changeText(
|
||||
screen.getByTestId('personalIdentityNumberInput'),
|
||||
'1212121212',
|
||||
),
|
||||
);
|
||||
await waitFor(() => fireEvent.press(screen.getByText('Heldag')));
|
||||
|
||||
expect(screen.getByText(/starttid/i)).toBeTruthy();
|
||||
expect(screen.getByText(/sluttid/i)).toBeTruthy();
|
||||
|
||||
await waitFor(() => fireEvent.press(screen.getByText('Skicka')));
|
||||
|
||||
expect(sendSMS).toHaveBeenCalledWith('121212-1212 1500-1700');
|
||||
});
|
|
@ -0,0 +1,241 @@
|
|||
import {useNavigation} from '@react-navigation/core';
|
||||
import {
|
||||
useApi,
|
||||
useCalendar,
|
||||
useChildList,
|
||||
useClassmates,
|
||||
useMenu,
|
||||
useNews,
|
||||
useNotifications,
|
||||
useSchedule,
|
||||
useTimetable,
|
||||
} from '../../libs/hooks/src';
|
||||
import React from 'react';
|
||||
import * as RNLocalize from 'react-native-localize';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {translate} from '../../utils/translation';
|
||||
import {Children} from '../children.component';
|
||||
|
||||
jest.mock('../../libs/hooks/src');
|
||||
|
||||
const setup = () => {
|
||||
return render(<Children />);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
useApi.mockReturnValue({
|
||||
api: {on: jest.fn(), off: jest.fn(), logout: jest.fn()},
|
||||
isLoggedIn: false,
|
||||
});
|
||||
RNLocalize.findBestAvailableLanguage.mockImplementationOnce(() => ({
|
||||
languageTag: 'sv',
|
||||
isRTL: false,
|
||||
}));
|
||||
useCalendar.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useNotifications.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useNews.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useSchedule.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useMenu.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useTimetable.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useClassmates.mockReturnValueOnce({data: [], status: 'loaded'});
|
||||
useNavigation.mockReturnValue({navigate: jest.fn(), setOptions: jest.fn()});
|
||||
});
|
||||
|
||||
test('renders loading state', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [],
|
||||
status: 'loading',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText(translate('general.loading'))).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders empty state message', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(
|
||||
screen.getByText(translate('children.noKids_description')),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders error state message', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [],
|
||||
status: 'error',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(
|
||||
screen.getByText(translate('children.loadingErrorHeading')),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders child in preschool', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson',
|
||||
status: 'F',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders child in elementary school', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson',
|
||||
status: 'GR',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders child in high school', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson',
|
||||
status: 'G',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText(translate('abbrevations.upperSecondarySchool')),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders multiple children', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Storasyster Testsson',
|
||||
status: 'G',
|
||||
},
|
||||
{
|
||||
name: 'Lillebror Testsson',
|
||||
status: 'GR',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Storasyster Testsson')).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText(translate('abbrevations.upperSecondarySchool')),
|
||||
).toBeTruthy();
|
||||
|
||||
expect(screen.getByText('Lillebror Testsson')).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText(translate('abbrevations.compulsorySchool')),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders child in class', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson',
|
||||
status: 'G',
|
||||
schoolID: 'Vallaskolan',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
useClassmates.mockReset();
|
||||
useClassmates.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
className: '8C',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
expect(screen.getByText('8C • Vallaskolan')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('removes any parenthesis from name', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson (elev)',
|
||||
status: 'G',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('handles multiple statuses for a child', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Test Testsson(elev)',
|
||||
status: 'G;GR;F',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
|
||||
const screen = setup();
|
||||
|
||||
var multipleStatusesRendered = `${translate(
|
||||
'abbrevations.upperSecondarySchool',
|
||||
)}, ${translate('abbrevations.compulsorySchool')}, ${translate(
|
||||
'abbrevations.leisureTimeCentre',
|
||||
)}`;
|
||||
|
||||
expect(screen.getByText('Test Testsson')).toBeTruthy();
|
||||
expect(screen.getByText(multipleStatusesRendered)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('says if there is nothing new this week', () => {
|
||||
useChildList.mockImplementationOnce(() => ({
|
||||
data: [
|
||||
{
|
||||
name: 'Kanye West',
|
||||
status: 'F',
|
||||
},
|
||||
],
|
||||
status: 'loaded',
|
||||
}));
|
||||
const screen = setup();
|
||||
|
||||
expect(
|
||||
screen.getByText(translate('news.noNewNewsItemsThisWeek')),
|
||||
).toBeTruthy();
|
||||
});
|
|
@ -0,0 +1,86 @@
|
|||
import {useClassmates} from '../../libs/hooks/src';
|
||||
import React from 'react';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {ChildProvider} from '../childContext.component';
|
||||
import {Classmates} from '../classmates.component';
|
||||
|
||||
jest.mock('../../libs/hooks/src');
|
||||
|
||||
const defaultClassmates = [
|
||||
{
|
||||
className: '2B',
|
||||
firstname: 'Tyrell',
|
||||
lastname: 'Eriksson',
|
||||
guardians: [
|
||||
{
|
||||
firstname: 'Margaery',
|
||||
lastname: 'Eriksson',
|
||||
},
|
||||
{
|
||||
firstname: 'Loras',
|
||||
lastname: 'Eriksson',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
className: '2B',
|
||||
firstname: 'Adam',
|
||||
lastname: 'Svensson',
|
||||
guardians: [
|
||||
{
|
||||
firstname: 'Eva',
|
||||
lastname: 'Svensson',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const setup = ({classmates} = {classmates: defaultClassmates}) => {
|
||||
useClassmates.mockReturnValue({
|
||||
data: classmates,
|
||||
});
|
||||
|
||||
return render(
|
||||
<ChildProvider child={{id: 1}}>
|
||||
<Classmates />
|
||||
</ChildProvider>,
|
||||
);
|
||||
};
|
||||
|
||||
test('gets the classmates for a child from context', () => {
|
||||
setup();
|
||||
|
||||
expect(useClassmates).toHaveBeenCalledWith({id: 1});
|
||||
});
|
||||
|
||||
test('renders class name', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText(/^klass 2b$/i)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders class without name', () => {
|
||||
const screen = setup({
|
||||
classmates: [],
|
||||
});
|
||||
|
||||
expect(screen.getByText(/^klass$/i)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders classmates sorted by first name', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByLabelText('Barn 1')).toContainElement(
|
||||
screen.getByText(/adam svensson/i),
|
||||
);
|
||||
expect(screen.getByLabelText('Barn 2')).toContainElement(
|
||||
screen.getByText(/tyrell eriksson/i),
|
||||
);
|
||||
});
|
||||
|
||||
test('renders guardians sorted by first name', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText(/eva svensson/i)).toBeTruthy();
|
||||
expect(screen.getByText(/^loras eriksson, margaery eriksson$/i)).toBeTruthy();
|
||||
});
|
|
@ -0,0 +1,146 @@
|
|||
import {fireEvent} from '@testing-library/react-native';
|
||||
import React from 'react';
|
||||
import {Linking} from 'react-native';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {ContactMenu} from '../contactMenu.component';
|
||||
|
||||
const defaultGuardian = {
|
||||
address: 'Testgatan',
|
||||
email: 'adam@adamsson.se',
|
||||
firstname: 'Adam',
|
||||
lastname: 'Adamsson',
|
||||
mobile: '0701234567',
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
contact: {
|
||||
guardians: [defaultGuardian],
|
||||
},
|
||||
};
|
||||
|
||||
const setup = (customProps = {}) => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
...customProps,
|
||||
};
|
||||
|
||||
return render(<ContactMenu {...props} />);
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
// Hide errors from state illegal state transition
|
||||
// Probably due to mock
|
||||
jest.spyOn(console, 'error').mockImplementation(() => {
|
||||
// noop
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
test('renders a parent', () => {
|
||||
const screen = setup();
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
expect(screen.getByText(/adam adamsson/i)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('displays option to call and text guardian', () => {
|
||||
const screen = setup();
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
fireEvent.press(screen.getByText(/ring/i));
|
||||
expect(Linking.openURL).toHaveBeenCalledWith('tel:0701234567');
|
||||
|
||||
fireEvent.press(screen.getByText(/sms/i));
|
||||
expect(Linking.openURL).toHaveBeenCalledWith('sms:0701234567');
|
||||
});
|
||||
|
||||
test('hides options to call and text if no phone number', () => {
|
||||
const guardianWithoutPhoneNumber = {
|
||||
contact: {
|
||||
guardians: [
|
||||
{
|
||||
...defaultGuardian,
|
||||
mobile: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const screen = setup(guardianWithoutPhoneNumber);
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
// expect(screen.getByTestId('CallMenuItem')).toHaveStyle({display: 'none'});
|
||||
// expect(screen.getByTestId('CallMenuItem')).toBeFalsy();
|
||||
// expect(screen.getByTestId('SMSMenuItem')).toHaveStyle({display: 'none'});
|
||||
// expect(screen.getByTestId('SMSMenuItem')).toBeFalsy();
|
||||
expect(screen.queryByTestId('CallMenuItem')).toBeNull();
|
||||
expect(screen.queryByTestId('SMSMenuItem')).toBeNull();
|
||||
});
|
||||
|
||||
test('displays option to email guardian', () => {
|
||||
const screen = setup();
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
fireEvent.press(screen.getByText(/maila/i));
|
||||
expect(Linking.openURL).toHaveBeenCalledWith('mailto:adam@adamsson.se');
|
||||
});
|
||||
|
||||
test('hides options to email phone number', () => {
|
||||
const guardianWithoutEmail = {
|
||||
contact: {
|
||||
guardians: [
|
||||
{
|
||||
...defaultGuardian,
|
||||
email: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const screen = setup(guardianWithoutEmail);
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
// expect(screen.getByTestId('SendEmailMenuItem')).toHaveStyle({
|
||||
// display: 'none',
|
||||
// });
|
||||
expect(screen.queryByTestId('SendEmailMenuItem')).toBeNull();
|
||||
});
|
||||
|
||||
test('displays address of guardian', () => {
|
||||
const screen = setup();
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
fireEvent.press(screen.getByText(/adress/i));
|
||||
expect(Linking.openURL).toHaveBeenCalledWith(
|
||||
'http://maps.apple.com/?daddr=Testgatan',
|
||||
);
|
||||
});
|
||||
|
||||
test('hides address if it does not exist', () => {
|
||||
const guardianWithoutAddress = {
|
||||
contact: {
|
||||
guardians: [
|
||||
{
|
||||
...defaultGuardian,
|
||||
address: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const screen = setup(guardianWithoutAddress);
|
||||
|
||||
fireEvent.press(screen.getByTestId('ShowContactInfoButton'));
|
||||
|
||||
// expect(screen.getByTestId('ShowHomeMenuItem')).toHaveStyle({
|
||||
// display: 'none',
|
||||
// });
|
||||
expect(screen.queryByTestId('ShowHomeMenuItem')).toBeNull();
|
||||
});
|
|
@ -0,0 +1,50 @@
|
|||
import {useMenu} from '../../libs/hooks/src';
|
||||
import React from 'react';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {translate} from '../../utils/translation';
|
||||
import {Menu} from '../menu.component';
|
||||
|
||||
jest.mock('../../libs/hooks/src');
|
||||
|
||||
const defaultItemList = [
|
||||
{
|
||||
title: 'Måndag vecka 10',
|
||||
description: 'Krämiga köttbullar',
|
||||
},
|
||||
{
|
||||
title: 'Tisdag vecka 10',
|
||||
description: 'Kryddig falukorv',
|
||||
},
|
||||
{
|
||||
title: 'Onsdag vecka 10',
|
||||
description: 'Sushi',
|
||||
},
|
||||
];
|
||||
|
||||
const setup = (itemList = defaultItemList) => {
|
||||
useMenu.mockReturnValue({
|
||||
data: itemList,
|
||||
});
|
||||
|
||||
return render(<Menu />);
|
||||
};
|
||||
|
||||
test('renders multiple days', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Måndag vecka 10')).toBeTruthy();
|
||||
expect(screen.getByText('Tisdag vecka 10')).toBeTruthy();
|
||||
expect(screen.getByText('Onsdag vecka 10')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders title and description', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Måndag vecka 10')).toBeTruthy();
|
||||
expect(screen.getByText('Krämiga köttbullar')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders empty menu', () => {
|
||||
const screen = setup([]);
|
||||
expect(screen.getByText(translate('menu.emptyText'))).toBeTruthy();
|
||||
});
|
|
@ -0,0 +1,89 @@
|
|||
import {useApi, useNewsDetails} from '../../libs/hooks/src';
|
||||
import React from 'react';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {NewsItem} from '../newsItem.component';
|
||||
|
||||
jest.mock('../../libs/hooks/src');
|
||||
|
||||
const defaultNewsItem = {
|
||||
author: 'Köket',
|
||||
fullImageUrl:
|
||||
'https://images.unsplash.com/photo-1629652487043-fb2825838f8c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2671&q=80',
|
||||
header: 'K-bullar!',
|
||||
published: '2021-02-15T09:13:28.484Z',
|
||||
modified: '2021-02-15T09:13:28.484Z',
|
||||
};
|
||||
|
||||
let navigation;
|
||||
|
||||
const setup = (customProps = {newsItem: {}}) => {
|
||||
useApi.mockReturnValue({api: {getSessionCookie: jest.fn()}});
|
||||
|
||||
useNewsDetails.mockReturnValue({
|
||||
data: {
|
||||
body: 'Nu blir det köttbullar',
|
||||
},
|
||||
});
|
||||
|
||||
navigation = {
|
||||
goBack: jest.fn(),
|
||||
};
|
||||
|
||||
const newsItem = {
|
||||
...defaultNewsItem,
|
||||
...customProps.newsItem,
|
||||
};
|
||||
|
||||
const props = {
|
||||
navigation,
|
||||
route: {
|
||||
params: {
|
||||
child: {id: 1},
|
||||
newsItem,
|
||||
},
|
||||
},
|
||||
...customProps,
|
||||
};
|
||||
|
||||
return render(<NewsItem {...props} />);
|
||||
};
|
||||
|
||||
test('gets article details using useNewsDetails', () => {
|
||||
setup();
|
||||
|
||||
expect(useNewsDetails).toHaveBeenCalledWith({id: 1}, defaultNewsItem);
|
||||
});
|
||||
|
||||
test('renders an article', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy();
|
||||
expect(screen.getByText('Publicerad: 15 feb 2021 10:13')).toBeTruthy();
|
||||
expect(screen.getByText('Uppdaterad: 15 feb 2021 10:13')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders an article without published date if date is invalid', () => {
|
||||
const newsItemWithoutPublishedDate = {
|
||||
...defaultNewsItem,
|
||||
published: '2020-08-16T21:10:00.000+02:0',
|
||||
};
|
||||
|
||||
const screen = setup({newsItem: newsItemWithoutPublishedDate});
|
||||
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy();
|
||||
expect(screen.getByText('Uppdaterad: 15 feb 2021 10:13')).toBeTruthy();
|
||||
expect(screen.queryByText('Publicerad: Invalid DateTime')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('renders an article without modified date if date is invalid', () => {
|
||||
const newsItemWithoutPublishedDate = {
|
||||
...defaultNewsItem,
|
||||
modified: null,
|
||||
};
|
||||
|
||||
const screen = setup({newsItem: newsItemWithoutPublishedDate});
|
||||
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy();
|
||||
expect(screen.getByText('Publicerad: 15 feb 2021 10:13')).toBeTruthy();
|
||||
expect(screen.queryByText('Uppdaterad: Invalid DateTime')).toBeFalsy();
|
||||
});
|
|
@ -0,0 +1,81 @@
|
|||
import { useNavigation } from '@react-navigation/native'
|
||||
import { fireEvent } from '@testing-library/react-native'
|
||||
import MockDate from 'mockdate'
|
||||
import React from 'react'
|
||||
import { render } from '../../utils/testHelpers'
|
||||
import { ChildProvider } from '../childContext.component'
|
||||
import { NewsListItem } from '../newsListItem.component'
|
||||
|
||||
const defaultItem = {
|
||||
author: 'Köket',
|
||||
intro: 'Nu blir det köttbullar',
|
||||
header: 'K-bullar!',
|
||||
published: '2021-02-15T09:13:28.484Z',
|
||||
modified: '2021-02-15T09:13:28.484Z',
|
||||
}
|
||||
|
||||
const setup = (customProps = {}) => {
|
||||
const props = {
|
||||
item: defaultItem,
|
||||
...customProps,
|
||||
}
|
||||
|
||||
return render(
|
||||
<ChildProvider child={{ id: 1 }}>
|
||||
<NewsListItem {...props} />
|
||||
</ChildProvider>
|
||||
)
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
MockDate.set('2021-02-15T09:30:28.484Z')
|
||||
})
|
||||
|
||||
test('renders an article', () => {
|
||||
const screen = setup()
|
||||
|
||||
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
|
||||
expect(screen.getByText('Köket • för 17 minuter sedan')).toBeTruthy()
|
||||
})
|
||||
|
||||
test('renders article without date', () => {
|
||||
const itemWithInvalidDate = {
|
||||
...defaultItem,
|
||||
published: null,
|
||||
modified: null,
|
||||
}
|
||||
|
||||
const screen = setup({ item: itemWithInvalidDate })
|
||||
|
||||
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
|
||||
expect(screen.getByText(/^köket$/i)).toBeTruthy()
|
||||
})
|
||||
|
||||
test('falls back to modified date if no published date', () => {
|
||||
const itemWithInvalidDate = {
|
||||
...defaultItem,
|
||||
published: null,
|
||||
}
|
||||
|
||||
const screen = setup({ item: itemWithInvalidDate })
|
||||
|
||||
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
|
||||
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
|
||||
expect(screen.getByText('Köket • för 17 minuter sedan')).toBeTruthy()
|
||||
})
|
||||
|
||||
test('navigates to news article on press', () => {
|
||||
const navigate = jest.fn()
|
||||
useNavigation.mockReturnValue({ navigate })
|
||||
|
||||
const screen = setup()
|
||||
|
||||
fireEvent.press(screen.getByText(/k-bullar!/i))
|
||||
|
||||
expect(navigate).toHaveBeenCalledWith('NewsItem', {
|
||||
child: { id: 1 },
|
||||
newsItem: defaultItem,
|
||||
})
|
||||
})
|
|
@ -0,0 +1,73 @@
|
|||
import React from 'react';
|
||||
import {render} from '../../utils/testHelpers';
|
||||
import {Notification} from '../notification.component';
|
||||
import MockDate from 'mockdate';
|
||||
|
||||
const defaultItem = {
|
||||
sender: 'Planering',
|
||||
category: 'Bedömning',
|
||||
dateCreated: '2021-02-15T09:13:28.484Z',
|
||||
dateModified: '2021-02-15T09:14:28.484Z',
|
||||
};
|
||||
|
||||
// copied from https://github.com/react-native-webview/react-native-webview/issues/2934#issuecomment-1524101977
|
||||
jest.mock('react-native-webview', () => {
|
||||
const {View} = require('react-native');
|
||||
return {
|
||||
WebView: View,
|
||||
};
|
||||
});
|
||||
//
|
||||
|
||||
const setup = (customProps = {}) => {
|
||||
const props = {
|
||||
item: defaultItem,
|
||||
...customProps,
|
||||
};
|
||||
|
||||
return render(<Notification {...props} />);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
MockDate.set('2021-02-15T09:30:28.484Z');
|
||||
});
|
||||
|
||||
test('renders subtitle with modified date', () => {
|
||||
const screen = setup();
|
||||
|
||||
expect(screen.getByText('Bedömning • för 16 minuter sedan')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders subtitle with created date', () => {
|
||||
const itemWithoutModifiedDate = {
|
||||
...defaultItem,
|
||||
dateModified: undefined,
|
||||
};
|
||||
|
||||
const screen = setup({item: itemWithoutModifiedDate});
|
||||
|
||||
expect(screen.getByText('Bedömning • för 17 minuter sedan')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders subtitle without date', () => {
|
||||
const itemWithoutDate = {
|
||||
...defaultItem,
|
||||
dateCreated: undefined,
|
||||
dateModified: undefined,
|
||||
};
|
||||
|
||||
const screen = setup({item: itemWithoutDate});
|
||||
|
||||
expect(screen.getByText('Bedömning')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('renders subtitle without category', () => {
|
||||
const itemWithoutCategory = {
|
||||
...defaultItem,
|
||||
category: undefined,
|
||||
};
|
||||
|
||||
const screen = setup({item: itemWithoutCategory});
|
||||
|
||||
expect(screen.getByText('för 16 minuter sedan')).toBeTruthy();
|
||||
});
|
|
@ -0,0 +1,133 @@
|
|||
import { fireEvent } from '@testing-library/react-native'
|
||||
import React from 'react'
|
||||
import RNCalendarEvents from 'react-native-calendar-events'
|
||||
import Toast from 'react-native-simple-toast'
|
||||
import { render } from '../../utils/testHelpers'
|
||||
import { SaveToCalendar } from '../saveToCalendar.component'
|
||||
|
||||
const defaultEvent = {
|
||||
title: 'Utvecklingssamtal',
|
||||
startDate: '2021-06-19 13:00',
|
||||
endDate: '2021-06-19 14:00',
|
||||
location: 'Gubbängsskolan',
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
event: defaultEvent,
|
||||
}
|
||||
|
||||
const setup = (customProps = {}) => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
...customProps,
|
||||
}
|
||||
|
||||
return render(<SaveToCalendar {...props} />)
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
// Hide errors from state illegal state transition
|
||||
// Probably due to mock
|
||||
jest.spyOn(console, 'error').mockImplementation(() => {
|
||||
// noop
|
||||
})
|
||||
})
|
||||
|
||||
beforeEach(jest.clearAllMocks)
|
||||
|
||||
test('renders save to calendar', () => {
|
||||
const screen = setup()
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
|
||||
expect(screen.getByText(/Spara/i)).toBeTruthy()
|
||||
})
|
||||
|
||||
test('requests calendar permissons', () => {
|
||||
const screen = setup()
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
|
||||
expect(RNCalendarEvents.requestPermissions).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('can save an event to the calendar', async () => {
|
||||
const screen = setup({
|
||||
event: {
|
||||
...defaultEvent,
|
||||
location: null,
|
||||
description: null,
|
||||
},
|
||||
})
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
await RNCalendarEvents.requestPermissions()
|
||||
|
||||
expect(RNCalendarEvents.saveEvent).toHaveBeenCalledWith('Utvecklingssamtal', {
|
||||
startDate: '2021-06-19T11:00:00.000Z',
|
||||
endDate: '2021-06-19T12:00:00.000Z',
|
||||
})
|
||||
})
|
||||
|
||||
test('removes any null values from the event', async () => {
|
||||
const screen = setup()
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
await RNCalendarEvents.requestPermissions()
|
||||
|
||||
expect(RNCalendarEvents.saveEvent).toHaveBeenCalledWith('Utvecklingssamtal', {
|
||||
startDate: '2021-06-19T11:00:00.000Z',
|
||||
endDate: '2021-06-19T12:00:00.000Z',
|
||||
location: 'Gubbängsskolan',
|
||||
})
|
||||
})
|
||||
|
||||
test('calls toast with success', async () => {
|
||||
const screen = setup()
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
await RNCalendarEvents.requestPermissions()
|
||||
await RNCalendarEvents.saveEvent()
|
||||
|
||||
expect(Toast.showWithGravity).toHaveBeenCalledWith(
|
||||
'✔️ Sparad till kalender',
|
||||
'short',
|
||||
'bottom'
|
||||
)
|
||||
})
|
||||
|
||||
test('says if something goes wrong', async () => {
|
||||
const screen = setup()
|
||||
RNCalendarEvents.saveEvent.mockRejectedValueOnce()
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
await RNCalendarEvents.requestPermissions()
|
||||
await RNCalendarEvents.saveEvent()
|
||||
|
||||
expect(Toast.showWithGravity).toHaveBeenCalledWith(
|
||||
'Något gick fel',
|
||||
'short',
|
||||
'bottom'
|
||||
)
|
||||
})
|
||||
|
||||
test('tells user if they havent authorized calendar', async () => {
|
||||
const screen = setup()
|
||||
RNCalendarEvents.requestPermissions.mockResolvedValueOnce('not auth')
|
||||
|
||||
fireEvent.press(screen.getByTestId('actionsButton'))
|
||||
fireEvent.press(screen.getByText(/Spara/i))
|
||||
await RNCalendarEvents.requestPermissions()
|
||||
await RNCalendarEvents.saveEvent()
|
||||
|
||||
expect(Toast.showWithGravity).toHaveBeenCalledWith(
|
||||
'Du måste godkänna åtkomst till kalendern',
|
||||
'short',
|
||||
'bottom'
|
||||
)
|
||||
})
|
|
@ -141,7 +141,8 @@ export const Children = () => {
|
|||
</View>
|
||||
) : (
|
||||
<View style={styles.loadingMessage}>
|
||||
<Spinner size="large" status="primary" />
|
||||
{/* <Spinner size="large" status="primary" /> */}
|
||||
<Text>Spinner here :D </Text>
|
||||
<Text category="h1" style={styles.loadingText}>
|
||||
{translate('general.loading')}
|
||||
</Text>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import {act, renderHook} from '@testing-library/react';
|
||||
import AppStorage from '../../services/appStorage';
|
||||
import useSettingsStorage, {settingsState} from '../useSettingsStorage';
|
||||
|
||||
beforeEach(() => {
|
||||
AsyncStorage.clear();
|
||||
// TODO: This is a bit ugly. Should probably fix that.
|
||||
settingsState.settings.theme = 'light';
|
||||
});
|
||||
|
||||
const prefix = AppStorage.settingsStorageKeyPrefix;
|
||||
|
||||
test('use key prefix on set', async () => {
|
||||
const {result} = renderHook(() => useSettingsStorage('theme'));
|
||||
|
||||
await act(async () => {
|
||||
const [, setValue] = result.current;
|
||||
setValue('dark');
|
||||
|
||||
//? maybe not the best fix but it works!
|
||||
// await waitForNextUpdate();
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
|
||||
const data = await AsyncStorage.getItem(prefix + 'SETTINGS');
|
||||
const parsed = JSON.parse(data ?? '');
|
||||
expect(parsed.theme).toEqual('dark');
|
||||
});
|
||||
});
|
||||
|
||||
test('update value', async () => {
|
||||
let data;
|
||||
let parsed;
|
||||
const {result} = renderHook(() => useSettingsStorage('theme'));
|
||||
|
||||
const [initValue, setValue] = result.current;
|
||||
|
||||
await act(async () => {
|
||||
expect(settingsState.settings.theme).toEqual('light');
|
||||
setValue('dark');
|
||||
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
// await waitForNextUpdate();
|
||||
|
||||
// const [updateValue] = result.current;
|
||||
|
||||
expect(initValue).toEqual('light');
|
||||
// expect(updateValue).toEqual('dark');
|
||||
|
||||
data = await AsyncStorage.getItem(prefix + 'SETTINGS');
|
||||
parsed = JSON.parse(data ?? '');
|
||||
expect(parsed.theme).toEqual('dark');
|
||||
expect(settingsState.settings.theme).toEqual('dark');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import useAsyncStorage from './useAsyncStorage';
|
||||
import AppStorage from '../services/appStorage';
|
||||
|
||||
export default function useTempStorage<T>(
|
||||
storageKey: string,
|
||||
defaultValue: T,
|
||||
): [T, (val: T) => void] {
|
||||
const tempKey = AppStorage.tempStorageKeyPrefix + storageKey;
|
||||
return useAsyncStorage(tempKey, defaultValue);
|
||||
}
|
|
@ -801,4 +801,4 @@ SPEC CHECKSUMS:
|
|||
|
||||
PODFILE CHECKSUM: 65fac31507ce363c84c5ab1cb333c7f711468d6a
|
||||
|
||||
COCOAPODS: 1.13.0
|
||||
COCOAPODS: 1.12.1
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
module.exports = {
|
||||
preset: 'react-native',
|
||||
// moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||
// setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||
// transform: {
|
||||
// // '\\.(js|ts|tsx)$': require.resolve('react-native/jest/preprocessor.js'),
|
||||
// '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
|
||||
// 'react-native/jest/assetFileTransformer.js'
|
||||
// ),
|
||||
// },
|
||||
// transformIgnorePatterns: [
|
||||
// 'node_modules/(?!(@react-native|react-native|@ronradtke/react-native-markdown-display|react-native-webview|react-native-calendar-events|react-native-simple-toast|react-native-modal-datetime-picker|@react-native-community/datetimepicker)/)',
|
||||
// ],
|
||||
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||
transform: {
|
||||
// '\\.(js|ts|tsx)$': require.resolve('react-native/jest/preprocessor.js'),
|
||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
|
||||
'react-native/jest/assetFileTransformer.js',
|
||||
),
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
// 'node_modules/(?!(@react-native|react-native|@ronradtke/react-native-markdown-display|react-native-webview|react-native-calendar-events|react-native-simple-toast|react-native-modal-datetime-picker|@react-native-community/datetimepicker)/)',
|
||||
'node_modules/(?!(@react-native|react-native|@ronradtke/react-native-markdown-display|react-native-webview|react-native-calendar-events|react-native-simple-toast|react-native-modal-datetime-picker|@react-native-community/datetimepicker|@ui-kitten)/)',
|
||||
],
|
||||
testEnvironment: 'jsdom',
|
||||
};
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`handles route calender 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Calender/GetSchoolCalender?childId=123&rowLimit=50"`;
|
||||
|
||||
exports[`handles route children 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/GetChildren"`;
|
||||
|
||||
exports[`handles route classmates 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/contacts/GetStudentsByClass?studentId=123"`;
|
||||
|
||||
exports[`handles route image 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/NewsBanner?url=https://example.com/img.png"`;
|
||||
|
||||
exports[`handles route login with personal number 1`] = `"https://login003.stockholm.se/NECSadcmbid/authenticate/NECSadcmbid?TYPE=33554433&REALMOID=06-42f40edd-0c5b-4dbc-b714-1be1e907f2de&GUID=1&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=IfNE0iMOtzq2TcxFADHylR6rkmFtwzoxRKh5nRMO9NBqIxHrc38jFyt56FASdxk1&TARGET=-SM-HTTPS%3a%2f%2flogin001%2estockholm%2ese%2fNECSadc%2fmbid%2fb64startpage%2ejsp%3fstartpage%3daHR0cHM6Ly9ldGphbnN0LnN0b2NraG9sbS5zZS92YXJkbmFkc2hhdmFyZS9pbmxvZ2dhZDIvaGVt&initialize=bankid&personalNumber=201701012393&_=1618404258782"`;
|
||||
|
||||
exports[`handles route login without personal number 1`] = `"https://login003.stockholm.se/NECSadcmbid/authenticate/NECSadcmbid?TYPE=33554433&REALMOID=06-42f40edd-0c5b-4dbc-b714-1be1e907f2de&GUID=1&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=IfNE0iMOtzq2TcxFADHylR6rkmFtwzoxRKh5nRMO9NBqIxHrc38jFyt56FASdxk1&TARGET=-SM-HTTPS%3a%2f%2flogin001%2estockholm%2ese%2fNECSadc%2fmbid%2fb64startpage%2ejsp%3fstartpage%3daHR0cHM6Ly9ldGphbnN0LnN0b2NraG9sbS5zZS92YXJkbmFkc2hhdmFyZS9pbmxvZ2dhZDIvaGVt&initialize=bankid&_=1618404258782"`;
|
||||
|
||||
exports[`handles route menuChoice 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Matsedel/GetMatsedelChoice?childId=123"`;
|
||||
|
||||
exports[`handles route menuList 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Matsedel/GetMatsedelList?childId=123"`;
|
||||
|
||||
exports[`handles route menuRss 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Matsedel/GetMatsedelRSS?childId=123"`;
|
||||
|
||||
exports[`handles route news 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsArchive?bannerImageLimit=5000&childId=123"`;
|
||||
|
||||
exports[`handles route newsDetails 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsArticle?newsItemId=321&childId=123"`;
|
||||
|
||||
exports[`handles route notifications 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/notifications/getnotifications?childId=123"`;
|
||||
|
||||
exports[`handles route schedule 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Calender/GetSchema?childId=123&startDate=2021-01-01&endDate=2021-01-01"`;
|
||||
|
||||
exports[`handles route user 1`] = `"https://etjanst.stockholm.se/vardnadshavare/base/getuserdata"`;
|
|
@ -0,0 +1,64 @@
|
|||
import QueueFetcher from '../queue/queueFetcher';
|
||||
|
||||
let sut: QueueFetcher;
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers('legacy');
|
||||
sut = new QueueFetcher(async () => '');
|
||||
});
|
||||
|
||||
test('creates queues for each id', () => {
|
||||
sut.fetch(async () => '', 'one');
|
||||
sut.fetch(async () => '', 'two');
|
||||
sut.fetch(async () => '', 'three');
|
||||
|
||||
expect(sut.Queues).toHaveLength(3);
|
||||
});
|
||||
|
||||
test('add same id to same queue', () => {
|
||||
sut.fetch(async () => '', 'one');
|
||||
sut.fetch(async () => '', 'one');
|
||||
sut.fetch(async () => '', 'one');
|
||||
|
||||
expect(sut.Queues).toHaveLength(1);
|
||||
expect(sut.Queues[0].id).toEqual('one');
|
||||
});
|
||||
|
||||
test('can run a task', async () => {
|
||||
const func = async () => 'output';
|
||||
const promise = sut.fetch(func, 'one');
|
||||
|
||||
jest.runOnlyPendingTimers();
|
||||
|
||||
const result = await promise;
|
||||
|
||||
expect(result).toEqual('output');
|
||||
});
|
||||
|
||||
test('can run many tasks', async () => {
|
||||
const promise1 = sut.fetch(async () => 'one', 'one');
|
||||
const promise2 = sut.fetch(async () => 'two', 'two');
|
||||
const promise3 = sut.fetch(async () => 'three', 'three');
|
||||
|
||||
await sut.schedule();
|
||||
await sut.schedule();
|
||||
await sut.schedule();
|
||||
|
||||
const result = await Promise.all([promise1, promise2, promise3]);
|
||||
|
||||
expect(result).toEqual(['one', 'two', 'three']);
|
||||
});
|
||||
|
||||
// test('sets up timer on fetch', () => {
|
||||
// sut.fetch(async () => 'one', 'one');
|
||||
|
||||
// expect(setTimeout).toHaveBeenCalledTimes(1);
|
||||
// });
|
||||
|
||||
test('sets up timer on fetch', () => {
|
||||
const setTimeoutSpy = jest.spyOn(global, 'setTimeout');
|
||||
sut.fetch(async () => 'one', 'one');
|
||||
expect(setTimeoutSpy).toHaveBeenCalledTimes(1);
|
||||
|
||||
// Restore the original setTimeout function
|
||||
setTimeoutSpy.mockRestore();
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
import * as routes from '../routes';
|
||||
|
||||
Date.now = jest.fn(() => 1618404258782);
|
||||
|
||||
test.each([
|
||||
['children', routes.children],
|
||||
['calender', routes.calendar('123')],
|
||||
['classmates', routes.classmates('123')],
|
||||
['user', routes.user],
|
||||
['news', routes.news('123')],
|
||||
['newsDetails', routes.newsDetails('123', '321')],
|
||||
['image', routes.image('https://example.com/img.png')],
|
||||
['notifications', routes.notifications('123')],
|
||||
['menuRss', routes.menuRss('123')],
|
||||
['menuList', routes.menuList('123')],
|
||||
['menuChoice', routes.menuChoice('123')],
|
||||
['schedule', routes.schedule('123', '2021-01-01', '2021-01-01')],
|
||||
['login with personal number', routes.login('201701012393')],
|
||||
['login without personal number', routes.login()],
|
||||
])('handles route %s', (_name, input) => {
|
||||
expect(input).toMatchSnapshot();
|
||||
});
|
|
@ -55,16 +55,18 @@
|
|||
"react-native-webview": "^13.6.0",
|
||||
"react-redux": "^8.1.2",
|
||||
"redux": "^4.2.1",
|
||||
"tough-cookie": "^4.1.3",
|
||||
"tslib": "^2.6.2",
|
||||
"valtio": "^1.11.2",
|
||||
"yup": "^1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@babel/runtime": "^7.20.0",
|
||||
"@react-native/eslint-config": "^0.72.2",
|
||||
"@react-native/metro-config": "^0.72.11",
|
||||
"@testing-library/jest-dom": "^6.1.3",
|
||||
"@testing-library/jest-native": "^5.4.3",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/react-native": "^12.3.0",
|
||||
"@tsconfig/react-native": "^3.0.0",
|
||||
|
@ -208,6 +210,7 @@
|
|||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz",
|
||||
"integrity": "sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.22.15"
|
||||
},
|
||||
|
@ -516,6 +519,7 @@
|
|||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.15.tgz",
|
||||
"integrity": "sha512-FB9iYlz7rURmRJyXRKEnalYPPdn87H5no108cyuQQyMwlpJ2SJtpIUBI27kdTin956pz+LPypkPVPUTlxOmrsg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -530,6 +534,7 @@
|
|||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.15.tgz",
|
||||
"integrity": "sha512-Hyph9LseGvAeeXzikV88bczhsrLrIZqDPxO+sSmAunMPaGrBGhfMWzCPYTtiW9t+HzSE2wtV8e5cc5P6r1xMDQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/helper-skip-transparent-expression-wrappers": "^7.22.5",
|
||||
|
@ -679,6 +684,7 @@
|
|||
"version": "7.21.0-placeholder-for-preset-env.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz",
|
||||
"integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
|
@ -724,6 +730,7 @@
|
|||
"version": "7.14.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz",
|
||||
"integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.14.5"
|
||||
},
|
||||
|
@ -763,6 +770,7 @@
|
|||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz",
|
||||
"integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.8.3"
|
||||
},
|
||||
|
@ -788,6 +796,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.22.5.tgz",
|
||||
"integrity": "sha512-rdV97N7KqsRzeNGoWUOK6yUsWarLjE5Su/Snk9IYPU9CwkWHs4t+rTGOvffTR8XGkJMTAdLfO0xVnXm8wugIJg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -802,6 +811,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.22.5.tgz",
|
||||
"integrity": "sha512-KwvoWDeNKPETmozyFE0P2rOLqh39EoQHNjqizrI5B8Vt0ZNS7M56s7dAiAqbYfiAYOuIzIh96z3iR2ktgu3tEg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -918,6 +928,7 @@
|
|||
"version": "7.14.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz",
|
||||
"integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.14.5"
|
||||
},
|
||||
|
@ -960,6 +971,7 @@
|
|||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz",
|
||||
"integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.18.6",
|
||||
"@babel/helper-plugin-utils": "^7.18.6"
|
||||
|
@ -989,6 +1001,7 @@
|
|||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.22.15.tgz",
|
||||
"integrity": "sha512-jBm1Es25Y+tVoTi5rfd5t1KLmL8ogLKpXszboWOTTtGFGz2RKnQe2yn7HbZ+kb/B8N0FVSGQo874NSlOU1T4+w==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-environment-visitor": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
|
@ -1050,6 +1063,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.22.5.tgz",
|
||||
"integrity": "sha512-nDkQ0NfkOhPTq8YCLiWNxp1+f9fCobEjCb0n8WdbNUBc4IB5V7P1QnX9IjpSoquKrXF5SKojHleVNs2vGeHCHQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1065,6 +1079,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.22.11.tgz",
|
||||
"integrity": "sha512-GMM8gGmqI7guS/llMFk1bJDkKfn3v3C4KHK9Yg1ey5qcHcOlKb0QvcMrgzvxo+T03/4szNh5lghY+fEC98Kq9g==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.11",
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
|
@ -1132,6 +1147,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.22.5.tgz",
|
||||
"integrity": "sha512-5/Yk9QxCQCl+sOIB1WelKnVRxTJDSAIxtJLL2/pqL14ZVlbH0fUQUZa/T5/UnQtBNgghR7mfB8ERBKyKPCi7Vw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1147,6 +1163,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.22.5.tgz",
|
||||
"integrity": "sha512-dEnYD+9BBgld5VBXHnF/DbYGp3fqGMsyxKbtD1mDyIA7AkTSpKXFhCVuj/oQVOoALfBs77DudA0BE4d5mcpmqw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -1161,6 +1178,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.22.11.tgz",
|
||||
"integrity": "sha512-g/21plo58sfteWjaO0ZNVb+uEOkJNjAaHhbejrnBmu011l/eNDScmkbjCC3l4FKb10ViaGU4aOkFznSu2zRHgA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3"
|
||||
|
@ -1176,6 +1194,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.22.5.tgz",
|
||||
"integrity": "sha512-vIpJFNM/FjZ4rh1myqIya9jXwrwwgFRHPjT3DkUA9ZLHuzox8jiXkOLvwm1H+PQIP3CqfC++WPKeuDi0Sjdj1g==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-builder-binary-assignment-operator-visitor": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1191,6 +1210,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.22.11.tgz",
|
||||
"integrity": "sha512-xa7aad7q7OiT8oNZ1mU7NrISjlSkVdMbNxn9IuLZyL9AJEhs1Apba3I+u5riX1dIkdptP5EKDG5XDPByWxtehw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-export-namespace-from": "^7.8.3"
|
||||
|
@ -1251,6 +1271,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.22.11.tgz",
|
||||
"integrity": "sha512-CxT5tCqpA9/jXFlme9xIBCc5RPtdDq3JpkkhgHQqtDdiTnTI0jtZ0QzXhr5DILeYifDPp2wvY2ad+7+hLMW5Pw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-json-strings": "^7.8.3"
|
||||
|
@ -1280,6 +1301,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.22.11.tgz",
|
||||
"integrity": "sha512-qQwRTP4+6xFCDV5k7gZBF3C31K34ut0tbEcTKxlX/0KXxm9GLcO14p570aWxFvVzx6QAfPgq7gaeIHXJC8LswQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-logical-assignment-operators": "^7.10.4"
|
||||
|
@ -1309,6 +1331,7 @@
|
|||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.23.0.tgz",
|
||||
"integrity": "sha512-xWT5gefv2HGSm4QHtgc1sYPbseOyf+FFDo2JbpE25GWl5BqTGO9IMwTYJRoIdjsF85GE+VegHxSCUt5EvoYTAw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-module-transforms": "^7.23.0",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1340,6 +1363,7 @@
|
|||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.0.tgz",
|
||||
"integrity": "sha512-qBej6ctXZD2f+DhlOC9yO47yEYgUh5CZNz/aBoH4j/3NOlRfJXJbY7xDQCqQVf9KbrqGzIWER1f23doHGrIHFg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-hoist-variables": "^7.22.5",
|
||||
"@babel/helper-module-transforms": "^7.23.0",
|
||||
|
@ -1357,6 +1381,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.22.5.tgz",
|
||||
"integrity": "sha512-+S6kzefN/E1vkSsKx8kmQuqeQsvCKCd1fraCM7zXm4SFoggI099Tr4G8U81+5gtMdUeMQ4ipdQffbKLX0/7dBQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-module-transforms": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1387,6 +1412,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.22.5.tgz",
|
||||
"integrity": "sha512-AsF7K0Fx/cNKVyk3a+DW0JLo+Ua598/NxMRvxDnkpCIGFh43+h/v2xyhRUYf6oD8gE4QtL83C7zZVghMjHd+iw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -1401,6 +1427,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.22.11.tgz",
|
||||
"integrity": "sha512-YZWOw4HxXrotb5xsjMJUDlLgcDXSfO9eCmdl1bgW4+/lAGdkjaEvOnQ4p5WKKdUgSzO39dgPl0pTnfxm0OAXcg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3"
|
||||
|
@ -1416,6 +1443,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.22.11.tgz",
|
||||
"integrity": "sha512-3dzU4QGPsILdJbASKhF/V2TVP+gJya1PsueQCxIPCEcerqF21oEcrob4mzjsp2Py/1nLfF5m+xYNMDpmA8vffg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-numeric-separator": "^7.10.4"
|
||||
|
@ -1431,6 +1459,7 @@
|
|||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz",
|
||||
"integrity": "sha512-fEB+I1+gAmfAyxZcX1+ZUwLeAuuf8VIg67CTznZE0MqVFumWkh8xWtn58I4dxdVf080wn7gzWoF8vndOViJe9Q==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.9",
|
||||
"@babel/helper-compilation-targets": "^7.22.15",
|
||||
|
@ -1464,6 +1493,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.22.11.tgz",
|
||||
"integrity": "sha512-rli0WxesXUeCJnMYhzAglEjLWVDF6ahb45HuprcmQuLidBJFWjNnOzssk2kuc6e33FlLaiZhG/kUIzUMWdBKaQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3"
|
||||
|
@ -1479,6 +1509,7 @@
|
|||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.0.tgz",
|
||||
"integrity": "sha512-sBBGXbLJjxTzLBF5rFWaikMnOGOk/BmK6vVByIdEggZ7Vn6CvWXZyRkkLFK6WE0IF8jSliyOkUN6SScFgzCM0g==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"@babel/helper-skip-transparent-expression-wrappers": "^7.22.5",
|
||||
|
@ -1509,6 +1540,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.22.5.tgz",
|
||||
"integrity": "sha512-PPjh4gyrQnGe97JTalgRGMuU4icsZFnWkzicB/fUtzlKUqvsWBKEpPPfr5a2JiyirZkHxnAqkQMO5Z5B2kK3fA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1524,6 +1556,7 @@
|
|||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.22.11.tgz",
|
||||
"integrity": "sha512-sSCbqZDBKHetvjSwpyWzhuHkmW5RummxJBVbYLkGkaiTOWGxml7SXt0iWa03bzxFIx7wOj3g/ILRd0RcJKBeSQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.22.5",
|
||||
"@babel/helper-create-class-features-plugin": "^7.22.11",
|
||||
|
@ -1615,6 +1648,7 @@
|
|||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.10.tgz",
|
||||
"integrity": "sha512-F28b1mDt8KcT5bUyJc/U9nwzw6cV+UmTeRlXYIl2TNqMMJif0Jeey9/RQ3C4NOd2zp0/TRsDns9ttj2L523rsw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5",
|
||||
"regenerator-transform": "^0.15.2"
|
||||
|
@ -1630,6 +1664,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.22.5.tgz",
|
||||
"integrity": "sha512-DTtGKFRQUDm8svigJzZHzb/2xatPc6TzNvAIJ5GqOKDsGFYgAskjRulbR/vGsPKq3OPqtexnz327qYpP57RFyA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -1720,6 +1755,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.22.5.tgz",
|
||||
"integrity": "sha512-bYkI5lMzL4kPii4HHEEChkD0rkc+nvnlR6+o/qdqR6zrm0Sv/nodmyLhlq2DO0YKLUNd2VePmPRjJXSBh9OIdA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -1751,6 +1787,7 @@
|
|||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.10.tgz",
|
||||
"integrity": "sha512-lRfaRKGZCBqDlRU3UIFovdp9c9mEvlylmpod0/OatICsSfuQ9YFthRo1tpTkGsklEefZdqlEFdY4A2dwTb6ohg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
@ -1765,6 +1802,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.22.5.tgz",
|
||||
"integrity": "sha512-HCCIb+CbJIAE6sXn5CjFQXMwkCClcOfPCzTlilJ8cUatfzwHlWQkbtV0zD338u9dZskwvuOYTuuaMaA8J5EI5A==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1795,6 +1833,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.22.5.tgz",
|
||||
"integrity": "sha512-lhMfi4FC15j13eKrh3DnYHjpGj6UKQHtNKTbtc1igvAhRy4+kLhV07OpLcsN0VgDEw/MjAvJO4BdMJsHwMhzCg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-create-regexp-features-plugin": "^7.22.5",
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
|
@ -1810,6 +1849,7 @@
|
|||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.22.20.tgz",
|
||||
"integrity": "sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.22.20",
|
||||
"@babel/helper-compilation-targets": "^7.22.15",
|
||||
|
@ -1919,6 +1959,7 @@
|
|||
"version": "0.1.6-no-external-plugins",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz",
|
||||
"integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@babel/types": "^7.4.4",
|
||||
|
@ -4910,6 +4951,94 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native": {
|
||||
"version": "5.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/jest-native/-/jest-native-5.4.3.tgz",
|
||||
"integrity": "sha512-/sSDGaOuE+PJ1Z9Kp4u7PQScSVVXGud59I/qsBFFJvIbcn4P6yYw6cBnBmbPF+X9aRIsTJRDl6gzw5ZkJNm66w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2",
|
||||
"jest-diff": "^29.0.1",
|
||||
"jest-matcher-utils": "^29.0.1",
|
||||
"pretty-format": "^29.0.3",
|
||||
"redent": "^3.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.0.0",
|
||||
"react-native": ">=0.59",
|
||||
"react-test-renderer": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/jest-native/node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/react": {
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.0.0.tgz",
|
||||
|
@ -11939,21 +12068,6 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/tough-cookie": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
|
||||
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.2.0",
|
||||
"url-parse": "^1.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/tr46": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||
|
@ -11966,15 +12080,6 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/universalify": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
|
@ -14263,8 +14368,7 @@
|
|||
"node_modules/querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"node_modules/queue": {
|
||||
"version": "6.0.2",
|
||||
|
@ -14989,6 +15093,7 @@
|
|||
"version": "0.15.2",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz",
|
||||
"integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4"
|
||||
}
|
||||
|
@ -15076,6 +15181,18 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/request/node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
|
@ -15092,8 +15209,7 @@
|
|||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.6",
|
||||
|
@ -16065,15 +16181,25 @@
|
|||
"integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg=="
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
|
||||
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.2.0",
|
||||
"url-parse": "^1.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tough-cookie/node_modules/universalify": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
|
@ -16391,7 +16517,6 @@
|
|||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
|
|
|
@ -58,16 +58,18 @@
|
|||
"react-native-webview": "^13.6.0",
|
||||
"react-redux": "^8.1.2",
|
||||
"redux": "^4.2.1",
|
||||
"tough-cookie": "^4.1.3",
|
||||
"tslib": "^2.6.2",
|
||||
"valtio": "^1.11.2",
|
||||
"yup": "^1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@babel/runtime": "^7.20.0",
|
||||
"@react-native/eslint-config": "^0.72.2",
|
||||
"@react-native/metro-config": "^0.72.11",
|
||||
"@testing-library/jest-dom": "^6.1.3",
|
||||
"@testing-library/jest-native": "^5.4.3",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/react-native": "^12.3.0",
|
||||
"@tsconfig/react-native": "^3.0.0",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// import '@testing-library/jest-native/extend-expect';
|
||||
import '@testing-library/jest-native/extend-expect';
|
||||
import moment from 'moment';
|
||||
import 'moment/locale/sv';
|
||||
import 'react-native-gesture-handler/jestSetup';
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
import moment from 'moment'
|
||||
import { getMeaningfulStartingDate } from '../calendarHelpers'
|
||||
import moment from 'moment';
|
||||
import {getMeaningfulStartingDate} from '../calendarHelpers';
|
||||
|
||||
const tuesdayMorning = moment('2021-11-30T08:20:00+0100')
|
||||
const tuesdayEvening = moment('2021-11-30T19:20:26+0100')
|
||||
const wednesdayEvening = moment('2021-12-01T19:20:26+0100')
|
||||
const fridayEvening = moment('2021-12-03T19:20:26+0100')
|
||||
const saturdayEvening = moment('2021-12-04T19:20:26+0100')
|
||||
const sundayEvening = moment('2021-12-05T19:20:26+0100')
|
||||
const mondayEvening = moment('2021-12-06T19:20:26+0100')
|
||||
const tuesdayMorning = moment('2021-11-30T08:20:00+0100');
|
||||
const tuesdayEvening = moment('2021-11-30T19:20:26+0100');
|
||||
const wednesdayEvening = moment('2021-12-01T19:20:26+0100');
|
||||
const fridayEvening = moment('2021-12-03T19:20:26+0100');
|
||||
const saturdayEvening = moment('2021-12-04T19:20:26+0100');
|
||||
const sundayEvening = moment('2021-12-05T19:20:26+0100');
|
||||
const mondayEvening = moment('2021-12-06T19:20:26+0100');
|
||||
|
||||
describe('getMeaningfulStartingDate should not touch inputdate', () => {
|
||||
const origDate = moment()
|
||||
const origDateClone = origDate.clone()
|
||||
getMeaningfulStartingDate(origDate)
|
||||
const origDate = moment();
|
||||
const origDateClone = origDate.clone();
|
||||
getMeaningfulStartingDate(origDate);
|
||||
|
||||
expect(origDate).toEqual(origDateClone)
|
||||
})
|
||||
expect(origDate).toEqual(origDateClone);
|
||||
});
|
||||
|
||||
describe('getMeaningfulStartingDate on weekends', () => {
|
||||
it('should give next monday if on friday evening', () => {
|
||||
const startDate = getMeaningfulStartingDate(fridayEvening)
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString())
|
||||
})
|
||||
const startDate = getMeaningfulStartingDate(fridayEvening);
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString());
|
||||
});
|
||||
|
||||
it('should give next monday if on saturday', () => {
|
||||
const startDate = getMeaningfulStartingDate(saturdayEvening)
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString())
|
||||
})
|
||||
const startDate = getMeaningfulStartingDate(saturdayEvening);
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString());
|
||||
});
|
||||
|
||||
it('should give next monday if on sunday', () => {
|
||||
const startDate = getMeaningfulStartingDate(sundayEvening)
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString())
|
||||
})
|
||||
})
|
||||
const startDate = getMeaningfulStartingDate(sundayEvening);
|
||||
expect(startDate.toISOString()).toEqual(mondayEvening.toISOString());
|
||||
});
|
||||
});
|
||||
|
||||
describe('getMeaningfulStartingDate on weekdays', () => {
|
||||
it('should give next day if on tuesday evening', () => {
|
||||
const startDate = getMeaningfulStartingDate(tuesdayEvening)
|
||||
expect(startDate.toISOString()).toEqual(wednesdayEvening.toISOString())
|
||||
})
|
||||
const startDate = getMeaningfulStartingDate(tuesdayEvening);
|
||||
expect(startDate.toISOString()).toEqual(wednesdayEvening.toISOString());
|
||||
});
|
||||
|
||||
it('should give same day if on tuesday morning', () => {
|
||||
const startDate = getMeaningfulStartingDate(tuesdayMorning)
|
||||
expect(startDate.toISOString()).toEqual(tuesdayMorning.toISOString())
|
||||
})
|
||||
})
|
||||
const startDate = getMeaningfulStartingDate(tuesdayMorning);
|
||||
expect(startDate.toISOString()).toEqual(tuesdayMorning.toISOString());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -979,7 +979,7 @@
|
|||
"@babel/helper-create-regexp-features-plugin" "^7.22.5"
|
||||
"@babel/helper-plugin-utils" "^7.22.5"
|
||||
|
||||
"@babel/preset-env@^7.1.6", "@babel/preset-env@^7.20.0":
|
||||
"@babel/preset-env@^7.1.6":
|
||||
version "7.22.20"
|
||||
resolved "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.22.20.tgz"
|
||||
integrity sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg==
|
||||
|
@ -1937,6 +1937,17 @@
|
|||
lodash "^4.17.15"
|
||||
redent "^3.0.0"
|
||||
|
||||
"@testing-library/jest-native@^5.4.3":
|
||||
version "5.4.3"
|
||||
resolved "https://registry.npmjs.org/@testing-library/jest-native/-/jest-native-5.4.3.tgz"
|
||||
integrity sha512-/sSDGaOuE+PJ1Z9Kp4u7PQScSVVXGud59I/qsBFFJvIbcn4P6yYw6cBnBmbPF+X9aRIsTJRDl6gzw5ZkJNm66w==
|
||||
dependencies:
|
||||
chalk "^4.1.2"
|
||||
jest-diff "^29.0.1"
|
||||
jest-matcher-utils "^29.0.1"
|
||||
pretty-format "^29.0.3"
|
||||
redent "^3.0.0"
|
||||
|
||||
"@testing-library/react-native@^12.3.0":
|
||||
version "12.3.0"
|
||||
resolved "https://registry.npmjs.org/@testing-library/react-native/-/react-native-12.3.0.tgz"
|
||||
|
@ -5104,7 +5115,7 @@ jest-config@^29.7.0:
|
|||
slash "^3.0.0"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
jest-diff@^29.7.0:
|
||||
jest-diff@^29.0.1, jest-diff@^29.7.0:
|
||||
version "29.7.0"
|
||||
resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz"
|
||||
integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==
|
||||
|
@ -5190,7 +5201,7 @@ jest-leak-detector@^29.7.0:
|
|||
jest-get-type "^29.6.3"
|
||||
pretty-format "^29.7.0"
|
||||
|
||||
jest-matcher-utils@^29.6.2, jest-matcher-utils@^29.7.0:
|
||||
jest-matcher-utils@^29.0.1, jest-matcher-utils@^29.6.2, jest-matcher-utils@^29.7.0:
|
||||
version "29.7.0"
|
||||
resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz"
|
||||
integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==
|
||||
|
@ -6724,7 +6735,7 @@ pretty-format@^27.0.2:
|
|||
ansi-styles "^5.0.0"
|
||||
react-is "^17.0.1"
|
||||
|
||||
pretty-format@^29.0.0, pretty-format@^29.6.2, pretty-format@^29.7.0:
|
||||
pretty-format@^29.0.0, pretty-format@^29.0.3, pretty-format@^29.6.2, pretty-format@^29.7.0:
|
||||
version "29.7.0"
|
||||
resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz"
|
||||
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==
|
||||
|
@ -7067,7 +7078,7 @@ react-shallow-renderer@^16.15.0:
|
|||
object-assign "^4.1.1"
|
||||
react-is "^16.12.0 || ^17.0.0 || ^18.0.0"
|
||||
|
||||
react-test-renderer@>=16.8.0, react-test-renderer@18.2.0:
|
||||
react-test-renderer@>=16.0.0, react-test-renderer@>=16.8.0, react-test-renderer@18.2.0:
|
||||
version "18.2.0"
|
||||
resolved "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz"
|
||||
integrity sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==
|
||||
|
@ -7076,7 +7087,7 @@ react-test-renderer@>=16.8.0, react-test-renderer@18.2.0:
|
|||
react-shallow-renderer "^16.15.0"
|
||||
scheduler "^0.23.0"
|
||||
|
||||
react@*, "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, react@>=16.2.0, react@>=16.8, react@>=16.8.0, react@>=17.0.0, react@>=18.1.0, react@18.2.0:
|
||||
react@*, "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, react@>=16.0.0, react@>=16.2.0, react@>=16.8, react@>=16.8.0, react@>=17.0.0, react@>=18.1.0, react@18.2.0:
|
||||
version "18.2.0"
|
||||
resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz"
|
||||
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
|
||||
|
@ -8008,7 +8019,7 @@ toposort@^2.0.2:
|
|||
resolved "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz"
|
||||
integrity sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==
|
||||
|
||||
tough-cookie@^4.1.2:
|
||||
tough-cookie@^4.1.2, tough-cookie@^4.1.3:
|
||||
version "4.1.3"
|
||||
resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz"
|
||||
integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==
|
||||
|
@ -8043,7 +8054,7 @@ tslib@^1.8.1:
|
|||
resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz"
|
||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||
|
||||
tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3:
|
||||
tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.6.2:
|
||||
version "2.6.2"
|
||||
resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz"
|
||||
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
|
||||
|
|
Loading…
Reference in New Issue