Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
85d95c6
test
itzJohn Nov 6, 2021
735bbb3
FIRST COMMIT
jwmaguire15 Nov 6, 2021
a7476dc
test
jwmaguire15 Nov 6, 2021
9b82363
Merge pull request #1 from FocalPoints/james
YogiPaturu Nov 6, 2021
53bbadd
test commit
YogiPaturu Nov 6, 2021
6f20fb8
Condition rendering functional
YogiPaturu Nov 6, 2021
de73149
class to functional, mapStateToProps
YogiPaturu Nov 6, 2021
3d50f28
Sign up and cancel button added
YogiPaturu Nov 6, 2021
70c590f
Login partially finished
YogiPaturu Nov 6, 2021
2ef3e3a
james and johnny progress on server and database
jwmaguire15 Nov 6, 2021
cf82f6a
Merge branch 'dev' into james
jwmaguire15 Nov 6, 2021
8f176f6
Beginning Main page
YogiPaturu Nov 6, 2021
0de82d8
Merge pull request #2 from FocalPoints/james
itzJohn Nov 6, 2021
b5bd52c
Merge pull request #3 from FocalPoints/john-ceci-yogi
itzJohn Nov 6, 2021
9044a00
Added sign up user action & sidebar/map
itzJohn Nov 6, 2021
6cc7e19
finished dbcontroller.verifyuser, updated routers, added todos
Nov 6, 2021
30dcbd1
Merge pull request #4 from FocalPoints/jb
jwmaguire15 Nov 7, 2021
7db1add
Merge pull request #5 from FocalPoints/john
jwmaguire15 Nov 7, 2021
4620ceb
modified verify user function
jwmaguire15 Nov 7, 2021
3ca59e0
Added: change location, friendlist dropdown, get midpoint
YogiPaturu Nov 7, 2021
397169d
bcrypt
jwmaguire15 Nov 7, 2021
be0e8a2
Merge pull request #6 from FocalPoints/james_server
itzJohn Nov 7, 2021
9f944eb
about to connect front-end and back-end
YogiPaturu Nov 7, 2021
ac4350e
Merge branch 'dev' into day-2
YogiPaturu Nov 7, 2021
8bef727
Merge pull request #7 from FocalPoints/day-2
itzJohn Nov 7, 2021
1137c97
Connected login to backend
YogiPaturu Nov 7, 2021
7e198df
Login GET and Signup POST working
YogiPaturu Nov 7, 2021
8a75909
Map displaying
YogiPaturu Nov 7, 2021
ea30fb2
Merge pull request #9 from FocalPoints/yogi-2
itzJohn Nov 7, 2021
94b1793
light styling and code organization
cecilyjansen Nov 8, 2021
f83dba2
more organization
cecilyjansen Nov 8, 2021
eedb756
sidebar org
cecilyjansen Nov 8, 2021
b23400e
Merge pull request #10 from FocalPoints/ceci
YogiPaturu Nov 8, 2021
8cb15a5
convert post request from query to body
cecilyjansen Nov 8, 2021
759f8ea
Merge pull request #11 from FocalPoints/ceci
YogiPaturu Nov 8, 2021
ba5601b
made username, ID, location dynamic upon login
cecilyjansen Nov 8, 2021
04851ff
added same state change to signup functionality
cecilyjansen Nov 8, 2021
ec60aa8
Styling Login / Sign Up Page
itzJohn Nov 8, 2021
052f293
added geocoder, updated middleware
Nov 8, 2021
8852271
progress on making friendsList/notFriendsList dynamic
cecilyjansen Nov 8, 2021
a04397d
Merge pull request #12 from FocalPoints/front-style
YogiPaturu Nov 8, 2021
d233f26
Merge pull request #13 from FocalPoints/ceci
itzJohn Nov 8, 2021
22eeb41
Merge pull request #14 from FocalPoints/johnny3
YogiPaturu Nov 8, 2021
6ba8ae9
got the friends and notFriends lists from db
jwmaguire15 Nov 8, 2021
bab30ca
adding friend
jwmaguire15 Nov 8, 2021
8363624
Merge pull request #15 from FocalPoints/james
YogiPaturu Nov 8, 2021
2fc48a6
dynamic friends list with coordinates, get midpoint, individual midpo…
YogiPaturu Nov 8, 2021
4b49d83
Merge pull request #17 from FocalPoints/johnny-john-yogi
itzJohn Nov 8, 2021
d0f741b
sidebar styled-ish
itzJohn Nov 8, 2021
df8ba95
Merge pull request #18 from FocalPoints/front-style-2
YogiPaturu Nov 8, 2021
221eb8d
updates
YogiPaturu Nov 8, 2021
2dbbe1f
Merge branch 'dev' into connection2
YogiPaturu Nov 8, 2021
d2c9beb
Merge pull request #19 from FocalPoints/connection2
YogiPaturu Nov 8, 2021
13b58d9
Changed lat & lng to address
itzJohn Nov 8, 2021
10a3071
Merge pull request #20 from FocalPoints/front-end-3
itzJohn Nov 8, 2021
9503375
got add friend, definitely has merge conflicts
jwmaguire15 Nov 9, 2021
40e036e
final commit
YogiPaturu Nov 9, 2021
4e59222
Merge pull request #21 from FocalPoints/maybe
itzJohn Nov 9, 2021
a4cb74c
Merge branch 'dev' into final-commit
itzJohn Nov 9, 2021
591c6ab
Merge pull request #22 from FocalPoints/final-commit
itzJohn Nov 9, 2021
021e7e3
james comments
jwmaguire15 Nov 9, 2021
b10923e
progress on making comments
jwmaguire15 Nov 9, 2021
59c97d1
progress on commenting backend
jwmaguire15 Nov 9, 2021
1c4065a
done?
jwmaguire15 Nov 9, 2021
c961113
got add friend working
jwmaguire15 Nov 9, 2021
a847a2f
Merge pull request #1 from CodesmithPandaWhale/james-comment-branch
jwmaguire15 Nov 9, 2021
4e280d2
added Jest and dummy files to begin development of testing
TERR-inss Nov 9, 2021
158fc5b
Merge branch 'dev' into testing
TERR-inss Nov 9, 2021
f05df76
Merge pull request #2 from CodesmithPandaWhale/testing
agbarbazan Nov 9, 2021
296a004
progress
jwmaguire15 Nov 9, 2021
bbb559f
Merge branch 'dev' into james-comment-branch
jwmaguire15 Nov 9, 2021
2f7730c
changed avatars, updated reducer, friends are now selected and render…
jwmaguire15 Nov 10, 2021
e4432b9
Merge pull request #3 from CodesmithPandaWhale/james-map
agbarbazan Nov 10, 2021
002df0f
still working on implementing testing
TERR-inss Nov 10, 2021
2ad86d4
Merge branch 'dev' into testing
TERR-inss Nov 10, 2021
52ef305
messed with the map, might revert
jwmaguire15 Nov 10, 2021
7e408d8
more changes to map
jwmaguire15 Nov 10, 2021
2044185
changed to new google maps API, having trouble with markers
jwmaguire15 Nov 10, 2021
522b3e9
made the side containers scroll
jwmaguire15 Nov 10, 2021
18febd1
markers are rendering on map
jwmaguire15 Nov 10, 2021
bd4b538
map avatars rendering
jwmaguire15 Nov 10, 2021
ce36498
got the midpoint rocking
jwmaguire15 Nov 10, 2021
d66c9cd
wip
Nov 10, 2021
dc79d3f
tests basic aspects of so-called dumb component, as well as successfu…
TERR-inss Nov 10, 2021
3e095a5
latest
Nov 10, 2021
619b335
Merge pull request #4 from CodesmithPandaWhale/james-map
agbarbazan Nov 11, 2021
362080f
Merge pull request #6 from CodesmithPandaWhale/testing
agbarbazan Nov 11, 2021
856b0a7
deleting Main.jsx
TERR-inss Nov 11, 2021
d9222c7
Delete ScheduleModal.jsx
TERR-inss Nov 11, 2021
f2cd83f
Update Sidebar.jsx
TERR-inss Nov 11, 2021
b2e736d
Merge branch 'dev' into Alex_update_location_v3
TERR-inss Nov 11, 2021
ba4db7d
Merge pull request #5 from CodesmithPandaWhale/Alex_update_location_v3
TERR-inss Nov 11, 2021
25096fe
Re-creating Main.jsx
TERR-inss Nov 11, 2021
9ea1689
Merge pull request #7 from CodesmithPandaWhale/TERR-inss-patch-1
jwmaguire15 Nov 11, 2021
1e18e38
working
Nov 11, 2021
3072ad2
feature done
Nov 11, 2021
d102ac2
more server testing added to supertest, cleared the default logIn inf…
TERR-inss Nov 11, 2021
85cda39
delete_friend missing button for testing
Nov 11, 2021
e730383
working on tests for signup endpoint
TERR-inss Nov 11, 2021
3cf05e7
Fully Crud
Nov 11, 2021
b78d848
Merge pull request #8 from CodesmithPandaWhale/Alex_delete_friend_v2
jwmaguire15 Nov 11, 2021
3b34827
james styling changes
jwmaguire15 Nov 11, 2021
28369d7
Merge branch 'dev' into james-map
jwmaguire15 Nov 11, 2021
ac70676
some changes to styling, and some bug fixes
jwmaguire15 Nov 11, 2021
120bb7c
Merge pull request #9 from CodesmithPandaWhale/james-map
agbarbazan Nov 11, 2021
0c41a3a
further supertest additions to test post requests
TERR-inss Nov 11, 2021
5fef6b6
Merge branch 'dev' into testing
TERR-inss Nov 11, 2021
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
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
package-lock.json
.DS_STORE
77 changes: 77 additions & 0 deletions React.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import toJson from 'enzyme-to-json';

// ConnectedAccess refers to the default export from the file, the destructuring is used to separately
// import the dumb component named Access which is not connected to mapStateToProps or mapDispatchToProps.
// In order to test the DUMB component, had to also specifically export it (see line 34 of Access.jsx)
import ConnectedAccess, { Access } from './client/components/Access.jsx';
import configureStore from 'redux-mock-store';

// Newer Enzyme versions require an adapter to a particular version of React
configure({ adapter: new Adapter() });


describe('React unit tests', () => {

let wrapper;

describe('Shallow Render REACT COMPONENTS', () => {
// pass in dummy props of the sort that Access expects
const props = {
pageToDisplay: 'login',
loggedIn: false,
midpoint: { lat: 40.7142700, lng: -74.0059700 },
currentUser: {},
selectedLocations: [],
friendsList: [],
notFriendsList: [],
};
describe('Access component', () => {
beforeAll(() => {
wrapper = shallow(<Access {...props} />);
});

it('renders the DUMB component', () => {
expect(wrapper.length).toEqual(1);
})

it('Renders a div, className loginStyles, with six child divs', () => {
expect(wrapper.find('div.loginStyles').children()).toHaveLength(6);
});

it('Renders two buttons', () => {
let count = 0;
wrapper.find('button').forEach(node => {
count++;
});
expect(count).toBe(2);
});
});
});

xdescribe('REACT-REDUX (Shallow + passing the store directly)', () => {
const initialState = {
pageToDisplay: 'login',
loggedIn: false,
midpoint: { lat: 40.7142700, lng: -74.0059700 },
currentUser: {},
selectedLocations: [],
friendsList: [],
notFriendsList: [],
currentUserID: 12
};
const mockStore = configureStore();
let store, container;

beforeEach(() => {
store = mockStore(initialState);
container = shallow(<ConnectedAccess store={store} />);
});

it('renders the connected(SMART) component', () => {
expect(container.length).toEqual(1);
})
});
});
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
116 changes: 116 additions & 0 deletions __tests__/supertest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
const request = require('supertest');
let server = 'http://localhost:8080';

describe('Server Tests', () => {
describe('/', () => {
describe('GET - root endpoint', () => {
// server = 'http://localhost:8080'
it('responds with 200 status and text/html content type', () => {
return request(server)
.get('/')
.expect('Content-type', /text\/html/)
.expect(200);
});
});
});

describe('/database/login', () => {
describe('GET - with invalid login', () => {
it('if no login info provided, responds with 404 status and application/json content type', () => {
return request(server)
.get('/database/login')
.expect('Content-type', /application\/json/)
.expect(404);
});

it('if invalid login info provided, responds with 404 status and application/json content type', () => {
return request(server)
.get('/database/login?username=ternce&password=petrsen')
.expect('Content-type', /application\/json/)
.expect(404);
});
});

describe('GET - with valid login', () => {
it('provided with *valid* login, responds with 200 status and application/json content type', () => {
return request(server)
.get('/database/login?username=terence&password=petersen')
.expect('Content-type', /application\/json/)
.expect(200)
});

it('--res.body contains "User verified!" message and verified prop set to true', () => {
return request(server)
.get('/database/login?username=terence&password=petersen')
.then(res => {
expect(res.body.message).toBe("User verified!");
expect(res.body.verified).toBe(true);
})
});

it('--res.body has a friendList property containing an array', () => {
return request(server)
.get('/database/login?username=terence&password=petersen')
.then(res => {
expect(res.body.friendList).toBeDefined();
expect(Array.isArray(res.body.friendList)).toBe(true);
});
});

it('--returned friendList array contains objects', () => {
return request(server)
.get('/database/login?username=terence&password=petersen')
.then(res => {
const { friendList } = res.body;
expect(friendList).toBeDefined();
expect(typeof friendList[0] === 'object' && !Array.isArray(friendList[0])).toBe(true);
});
});
});
});

describe('/database/signup', () => {
// both of the below tests fail.
// need to determine if it is the tests that are written incorrectly
// or if the application is not behaving as expected
describe('POST - with invalid user/password input(s)', () => {

// shows the server returning 500 "Internal Server Error", unlike the response shown in the browser
it('returns status 401', () => {
return request(server)
.post('/database/signup')
.send({ username: '', password: '', address: '123 fake street' })
.expect(401);
});

// the console log shows res.body to be an empty object
it('returns "Invalid username and/or password!" message', () => {
return request(server)
.post('/database/signup')
.send({ username: '', password: '', address: '123 fake street' })
.then(res => {
console.log(res.body);
expect(res.body.message).toBe('Invalid username and/or password!');
});
});
});

describe('POST - with invalid address input', () => {
it ('returns status 500', () => {
return request(server)
.post('/database/signup')
.send({ username: 'newguy3', password: 'okiedokie', address: 'gjeirogrj' })
.expect(500);
});
});

describe('POST - with valid inputs', () => {
it ('returns status 200', () => {
return request(server)
.post('/database/signup')
.send({ username: 'newguy4', password: 'okiedokie', address: '123 fake street' })
.expect(201);
})
})
});
});
2 changes: 2 additions & 0 deletions build/bundle.js

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions build/bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/**
* React Router v6.0.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
1 change: 1 addition & 0 deletions build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><head><meta charset="UTF-8"><title>Halfway</title><script defer="defer" src="bundle.js"></script></head><body style="margin:0px" height="1000px"><div id="root">Index.html</div></body></html>
21 changes: 21 additions & 0 deletions client/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { BrowserRouter as Router, Route, Routes as Switch } from 'react-router-dom'
import Access from './components/Access'
import Main from './components/Main'


// connect to endpoints
const App = () => (
<div id="app">
<Router>
<Switch>
{/* default page: not yet logged in, route to Access */}
<Route path='/' element={<Access/>} />
{/* when logged in, route to Main */}
<Route path='/main' element={<Main />} />
</Switch>
</Router>
</div>
);

export default App;
Loading