Skip to content

Commit

Permalink
Merge branch 'master' into fix_log_email
Browse files Browse the repository at this point in the history
  • Loading branch information
the-bay-kay committed Jun 24, 2024
2 parents e81164c + 461e5fe commit 754de73
Show file tree
Hide file tree
Showing 37 changed files with 1,373 additions and 480 deletions.
2 changes: 1 addition & 1 deletion package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"cordova-custom-config": "^5.1.1",
"cordova-plugin-ibeacon": "git+https://github.com/louisg1337/cordova-plugin-ibeacon.git",
"core-js": "^2.5.7",
"e-mission-common": "git+https://github.com/JGreenlee/e-mission-common.git#0.4.4",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"chartjs-adapter-luxon": "^1.3.1",
"chartjs-plugin-annotation": "^3.0.1",
"core-js": "^2.5.7",
"e-mission-common": "git+https://github.com/JGreenlee/e-mission-common.git#0.4.4",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand Down
26 changes: 26 additions & 0 deletions www/__tests__/Carousel.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { render } from '@testing-library/react-native';
import { View } from 'react-native';
import Carousel from '../js/components/Carousel';

describe('Carousel component', () => {
const child1 = <View testID="child1">Child 1</View>;
const child2 = <View testID="child2">Child 2</View>;
const cardWidth = 100;
const cardMargin = 10;

it('renders children correctly', () => {
const { getByTestId } = render(
<Carousel cardWidth={cardWidth} cardMargin={cardMargin}>
{child1}
{child2}
</Carousel>,
);

const renderedChild1 = getByTestId('child1');
const renderedChild2 = getByTestId('child2');

expect(renderedChild1).toBeTruthy();
expect(renderedChild2).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions www/__tests__/DateSelect.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { render, screen } from '@testing-library/react-native';
import DateSelect from '../js/diary/list/DateSelect';

jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ bottom: 30, left: 0, right: 0, top: 30 }),
}));
jest.spyOn(React, 'useState').mockImplementation((initialValue) => [initialValue, jest.fn()]);
jest.spyOn(React, 'useEffect').mockImplementation((effect: () => void) => effect());

describe('DateSelect', () => {
it('renders correctly', () => {
const onChooseMock = jest.fn();
const { getByText } = render(<DateSelect mode="range" onChoose={onChooseMock} />);

expect(screen.getByTestId('button-container')).toBeTruthy();
expect(screen.getByTestId('button')).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions www/__tests__/appTheme.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { getTheme } from '../js/appTheme';

describe('getTheme', () => {
it('should return the right theme with place', () => {
const theme = getTheme('place');
expect(theme.colors.elevation.level1).toEqual('#cbe6ff');
});

it('should return the right theme with untracked', () => {
const theme = getTheme('untracked');
expect(theme.colors.primary).toEqual('#8c4a57');
expect(theme.colors.primaryContainer).toEqual('#e3bdc2');
expect(theme.colors.elevation.level1).toEqual('#f8ebec');
});

it('should return the right theme with draft', () => {
const theme = getTheme('draft');
expect(theme.colors.primary).toEqual('#616971');
expect(theme.colors.primaryContainer).toEqual('#b6bcc2');
expect(theme.colors.background).toEqual('#eef1f4');
});
});
Loading

0 comments on commit 754de73

Please sign in to comment.