This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
forked from maisieccino/ucl-assistant-app
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1031 from uclapi/shu8/start-of-year-fixes
Fix crash on first login & scrollToIndex crash
- Loading branch information
Showing
8 changed files
with
43,675 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...metable/TimetableDetailScreen/__tests__/__snapshots__/TimetableDetailScreen.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TimetableDetailScreen renders the TimetableDetailScreen 1`] = `"{\\"initialRegion\\":{\\"latitude\\":51.5246586,\\"latitudeDelta\\":0.0012,\\"longitude\\":-0.1339784,\\"longitudeDelta\\":0.0071},\\"date\\":\\"2020-01-01\\",\\"contact\\":\\"Anne Oldman\\",\\"end_time\\":\\"00:01\\",\\"location\\":{\\"address\\":[\\"221C Banana Bread Street\\"],\\"name\\":\\"Waffle House\\"},\\"module\\":{\\"department_name\\":\\"Criminology\\",\\"lecturer\\":{\\"department_id\\":\\"CRIM\\",\\"name\\":\\"Jack Cloth\\"},\\"module_id\\":\\"ABC123\\"},\\"start_time\\":\\"00:00\\",\\"navigation\\":{}}"`; | ||
|
||
exports[`TimetableDetailScreen renders the TimetableDetailScreen with no entries 1`] = `"{\\"initialRegion\\":{\\"latitude\\":51.5246586,\\"latitudeDelta\\":0.0012,\\"longitude\\":-0.1339784,\\"longitudeDelta\\":0.0071},\\"date\\":\\"2020-01-01\\",\\"navigation\\":{}}"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
screens/Timetable/TimetableScreen/__tests__/WeekView.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import { cleanup, render } from "@testing-library/react-native" | ||
import MockDate from 'mockdate' | ||
import React from 'react' | ||
import "react-native" | ||
import { LocalisationManager } from "../../../../lib" | ||
import WeekView from "../components/WeekView" | ||
|
||
describe(`WeekView`, () => { | ||
MockDate.set(`2019-11-18T08:47:21.000Z`) | ||
|
||
afterEach(() => { | ||
cleanup() | ||
}) | ||
|
||
it(`renders the WeekView component`, () => { | ||
const mockProps = { | ||
date: LocalisationManager.getMoment().subtract(7, `days`), | ||
isLoading: false, | ||
navigation: { | ||
dispatch: jest.fn(), | ||
navigate: jest.fn(), | ||
} as any, | ||
onDateChanged: () => null, | ||
onIndexChanged: () => null, | ||
onRefresh: () => null, | ||
timetable: [ | ||
{ | ||
contact: `Anne Oldman`, | ||
end_time: `00:01`, | ||
location: { | ||
address: [ | ||
`221C Banana Bread Street`, | ||
], | ||
name: `Waffle House`, | ||
}, | ||
module: { | ||
department_name: `Criminology`, | ||
lecturer: { | ||
department_id: `CRIM`, | ||
name: `Jack Cloth`, | ||
}, | ||
module_id: `ABC123`, | ||
}, | ||
start_time: `00:00`, | ||
}, | ||
], | ||
} | ||
const wrapper = render(<WeekView {...mockProps} />) | ||
expect(wrapper).toMatchSnapshot() | ||
}) | ||
}) |
Oops, something went wrong.