Skip to content

Commit

Permalink
Merge branch 'develop' into feature/get-user-api-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
shreya-mishra authored Aug 9, 2023
2 parents 75599eb + 423cbbd commit 0f88018
Show file tree
Hide file tree
Showing 41 changed files with 1,367 additions and 801 deletions.
3 changes: 0 additions & 3 deletions .editorconfig

This file was deleted.

65 changes: 65 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
emoji=true

exact_by_default=true

format.bracket_spacing=false

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.162.0
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/continous-integeration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:
- name: Prettier Check
run: |
yarn format-check
- name: Running test
run: |
yarn test
# - name: Running test
# run: |
# yarn test
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
100 changes: 100 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.11.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.2)
activesupport (>= 5.0, < 7)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
escape (0.0.4)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.3)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.11, >= 1.11.2)

RUBY VERSION
ruby 2.7.4p191

BUNDLED WITH
2.2.27
23 changes: 23 additions & 0 deletions __tests__/AuthScreen-test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import { screen, render, fireEvent } from '@testing-library/react-native';
import AuthScreen from '../src/screens/AuthScreen/AuthScreen';
import Strings from '../src/i18n/en';
import { Toast } from 'react-native-toast-message/lib/src/Toast';

it('AuthScreen is rendered', () => {
render(<AuthScreen />);
screen.getByText(/welcome to/i);
screen.getByText(/real dev squad/i);
});

it('Clicking on Sign in with Github shows a toast', async () => {
render(
<>
<AuthScreen />
<Toast />
</>,
);
const githubSignInBtn = screen.getByText(Strings.SIGN_IN_BUTTON_TEXT);
fireEvent.press(githubSignInBtn);
screen.getByText(/Sign in with GitHub coming soon/i);
});
46 changes: 6 additions & 40 deletions __tests__/Component-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ import React from 'react';
import { fireEvent, render } from '@testing-library/react-native';
import ShortGoalsComponent from '../src/components/ShortGoalsComponent/ShortGoalsComponent';
import Card from '../src/components/ToDoComponent/Card';
import Data from '../src/components/ToDoComponent/Data';
import 'react-native-gesture-handler';
import DurationDropdown from '../src/components/CreateGoalForm/Dropdown';
import FloatingButton from '../src/components/FloatingButton';
import Strings from '../src/i18n/en';
import AuthScreen from '../src/screens/AuthScreen/AuthScreen';
import { OtpModal } from '../src/screens/AuthScreen/OtpModal';

// Short Term Goals component test

Expand Down Expand Up @@ -85,10 +81,15 @@ jest.mock('react-native-reanimated', () => {
};
});

const DATA = {
title: 'Task1',
assigned_by: 'admin',
};

test('setTimeout called which calls other two functions remove and changecard', () => {
const { getByTestId } = render(
<Card
item={Data[0]}
item={DATA}
posStyle="relative"
changecard={() => {}}
removeCard={() => {}}
Expand All @@ -103,38 +104,3 @@ test('setTimeout called which calls other two functions remove and changecard',
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 4000);
});

//Sign In Withh Web and OtpModal Component Test
test('Check is sign in with web and otpmodal is rendering', () => {
const { getByText, queryByTestId } = render(<AuthScreen />);
const SignInWithWeb = getByText(Strings.SIGN_IN_WITH_WEB);
expect(SignInWithWeb).toBeTruthy();
expect(queryByTestId('otpModal')).toBeNull();
fireEvent.press(SignInWithWeb);
expect(queryByTestId('otpModal')).toBeTruthy();
});

test('Check otpmodal submit to be disabled and enabled', () => {
const props = {
title: Strings.ENTER_4_DIGIT_OTP,
testId: 'otpModal',
visible: true,
code: '',
setCode: () => {},
closeModal: () => {},
};
const data = [
{ code: '', disabled: true },
{ code: '12', disabled: true },
{ code: '1234', disabled: false },
];
data.forEach(({ code, disabled }) => {
const { getByTestId } = render(
<OtpModal maxLength={4} {...props} code={code} />,
);
expect(getByTestId('submitOtpModal').props).toHaveProperty(
'accessibilityState',
{ disabled },
);
});
});
29 changes: 21 additions & 8 deletions __tests__/Goals/GoalsScreen-test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import React from 'react';
import { render } from '@testing-library/react-native';
import GoalScreen from '../../src/screens/GoalScreen/GoalScreen';
import { NavigationContainer } from '@react-navigation/native';

test('renders GoalScreen correctly', () => {
const { getByTestId } = render(<GoalScreen />);

// Verify that the TodoComponent is rendered
const todoComponent = getByTestId('todo-component');
expect(todoComponent).toBeTruthy();

// TODO: Add assertions for ShortGoalsComponent and LongGoalsComponent once they are implemented.
// test('renders GoalScreen correctly', () => {
// const { getByTestId } = render(<GoalScreen />);

// // Verify that the TodoComponent is rendered
// const todoComponent = getByTestId('todo-component');
// expect(todoComponent).toBeTruthy();

// // TODO: Add assertions for ShortGoalsComponent and LongGoalsComponent once they are implemented.
// });

describe('GoalScreen', () => {
test.skip('renders GoalScreen correctly', () => {
const { getByTestId } = render(
<NavigationContainer>
<GoalScreen />
</NavigationContainer>,
);
const todoComponent = getByTestId('todo-component');
expect(todoComponent).toBeTruthy();
});
});
35 changes: 28 additions & 7 deletions __tests__/Goals/components/Card-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,48 @@ describe('Card', () => {
isread: false,
};

test('renders task correctly', () => {
test.skip('renders task correctly', () => {
const { getByText } = render(
<Card item={item} posStyle="relative" changecard={() => {}} removeCard={() => {}} disabled={false} setDisabled={() => {}} />
<Card
item={item}
posStyle="relative"
changecard={() => {}}
removeCard={() => {}}
disabled={false}
setDisabled={() => {}}
/>,
);
const taskElement = getByText('Sample Task');
expect(taskElement).toBeTruthy();
});

test('calls changecard function when pan gesture ends with translateY > 100', () => {
test.skip('calls changecard function when pan gesture ends with translateY > 100', () => {
const changecardMock = jest.fn();
const { getByTestId } = render(
<Card item={item} posStyle="relative" changecard={changecardMock} removeCard={() => {}} disabled={false} setDisabled={() => {}} />
<Card
item={item}
posStyle="relative"
changecard={changecardMock}
removeCard={() => {}}
disabled={false}
setDisabled={() => {}}
/>,
);
const animatedView = getByTestId('animated-view');
fireEvent.panEnd(animatedView, { translationY: 150 });
fireEvent(animatedView, 'panEnd', { translationY: 150 });
expect(changecardMock).toHaveBeenCalledWith(1);
});

test('marks the card as done and shows a toast message when "Mark Done" button is pressed', () => {
test.skip('marks the card as done and shows a toast message when "Mark Done" button is pressed', () => {
const { getByTestId, getByText } = render(
<Card item={item} posStyle="relative" changecard={() => {}} removeCard={() => {}} disabled={false} setDisabled={() => {}} />
<Card
item={item}
posStyle="relative"
changecard={() => {}}
removeCard={() => {}}
disabled={false}
setDisabled={() => {}}
/>,
);
const markDoneButton = getByTestId('doneBtn');
fireEvent.press(markDoneButton);
Expand Down
Loading

0 comments on commit 0f88018

Please sign in to comment.