Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx prettier -w .

git add .
npx prettier -c .
3 changes: 2 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import { Home, NewGoal } from './pages';
import { createTables } from './database';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { useEffect } from 'react';
import type { RootStackParamList } from './types';

const Stack = createNativeStackNavigator();
const Stack = createNativeStackNavigator<RootStackParamList>();

export default function App() {
useEffect(() => createTables(), []);
Expand Down
68 changes: 0 additions & 68 deletions __tests__/__snapshots__/home.test.tsx.snap

This file was deleted.

Empty file.
2 changes: 0 additions & 2 deletions __tests__/components/text-input.test.tsx

This file was deleted.

146 changes: 146 additions & 0 deletions __tests__/snapshot-tests/__snapshots__/home.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#fff",
"flex": 1,
"height": "100%",
"margin": 0,
}
}
>
<View
accessibilityIgnoresInvertColors={true}
style={
Object {
"alignItems": "center",
"height": 1334,
"margin": 0,
"paddingTop": "15%",
"width": 750,
}
}
>
<Image
resizeMode="cover"
source={1}
style={
Array [
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
Object {
"height": 1334,
"width": 750,
},
undefined,
]
}
/>
<Text
style={
Object {
"fontSize": 24,
}
}
>
Good Afternoon!
</Text>
<Text
style={
Object {
"fontSize": 16,
"marginTop": "3%",
}
}
>
How was lunch?
</Text>
<View
accessible={true}
collapsable={false}
focusable={true}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"JustifyContent": "center",
"alignItems": "center",
"backgroundColor": "black",
"borderRadius": 4,
"elevation": 3,
"paddingHorizontal": 32,
"paddingVertical": 12,
}
}
>
<Text
style={
Object {
"color": "white",
"fontSize": 16,
"fontWeight": "bold",
"letterSpacing": 0.25,
"lineHeight": 21,
}
}
>
New Goal
</Text>
</View>
<View
accessible={true}
collapsable={false}
focusable={true}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"JustifyContent": "center",
"alignItems": "center",
"backgroundColor": "black",
"borderRadius": 4,
"elevation": 3,
"paddingHorizontal": 32,
"paddingVertical": 12,
}
}
>
<Text
style={
Object {
"color": "white",
"fontSize": 16,
"fontWeight": "bold",
"letterSpacing": 0.25,
"lineHeight": 21,
}
}
>
Log Goals
</Text>
</View>
</View>
</View>
`;
92 changes: 92 additions & 0 deletions __tests__/snapshot-tests/__snapshots__/new-goal.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<View
onLayout={[Function]}
style={
Object {
"paddingBottom": 0,
}
}
>
<RCTSafeAreaView
accessible={true}
emulateUnlessSupported={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"flexGrow": 1,
}
}
>
<TextInput
onChangeText={[Function]}
placeholder="Goal Name..."
style={
Object {
"borderRadius": 6,
"marginTop": 200,
}
}
value=""
/>
<TextInput
onChangeText={[Function]}
placeholder="Goal Description..."
style={
Object {
"borderRadius": 6,
"marginTop": 200,
}
}
value=""
/>
<View
accessible={true}
collapsable={false}
focusable={true}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"JustifyContent": "center",
"alignItems": "center",
"backgroundColor": "black",
"borderRadius": 4,
"elevation": 3,
"paddingHorizontal": 32,
"paddingVertical": 12,
}
}
>
<Text
style={
Object {
"color": "white",
"fontSize": 16,
"fontWeight": "bold",
"letterSpacing": 0.25,
"lineHeight": 21,
}
}
>
Submit
</Text>
</View>
</RCTSafeAreaView>
</View>
`;
15 changes: 15 additions & 0 deletions __tests__/snapshot-tests/home.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { create } from 'react-test-renderer';
import { Home } from '../../pages';

beforeEach(() => {
jest.mock('expo-sqlite');
console.error = jest.fn();
jest.useFakeTimers('modern').setSystemTime(new Date(2022, 8, 22, 13));
});

it('renders correctly', () => {
const tree = create(
<Home route={undefined} navigation={undefined} />
).toJSON();
expect(tree).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { create } from 'react-test-renderer';
import Home from '../../pages/home';
import { NewGoal } from '../../pages';

it('renders correctly', () => {
const tree = create(<Home />).toJSON();
const tree = create(<NewGoal />).toJSON();
expect(tree).toMatchSnapshot();
});
File renamed without changes.
2 changes: 1 addition & 1 deletion components/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as Button } from './goal-button';
export { default as Button } from './button';
export { default as SomeText } from './text-input';
4 changes: 2 additions & 2 deletions database/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as SQLite from 'expo-sqlite';
import { openDatabase } from 'expo-sqlite';

/** Interface for Long Term Goals */
export interface LongTermGoal {
Expand All @@ -11,7 +11,7 @@ export interface LongTermGoal {
}

/** expo-sqlite database object */
const db = SQLite.openDatabase('db.testDb');
const db = openDatabase('db.testDb');

export function createTables() {
db.transaction(
Expand Down
Loading