Skip to content

Commit c7e0a65

Browse files
authored
Merge pull request #10 from oslabs-beta/adamsoph-login
Adamsoph login
2 parents ed6d2e2 + b68718c commit c7e0a65

File tree

6 files changed

+23
-29
lines changed

6 files changed

+23
-29
lines changed

__tests__/userAuth.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
* @jest-environment node
33
*/
44

5-
// import {
6-
// sessionIsCreated,
7-
// newUserIsCreated
8-
// } from '../app/src/helperFunctions/auth';
5+
import {
6+
sessionIsCreated,
7+
newUserIsCreated
8+
} from '../app/src/helperFunctions/auth';
99

10-
// const { Mongoose } = require('mongoose');
10+
const { Mongoose } = require('mongoose');
1111

12-
// const http = require('http');
13-
// const app = require('../server/server.js');
12+
const http = require('http');
13+
const app = require('../server/server.mjs');
1414

15-
// let server;
15+
let server;
1616

1717
// tests auth.ts helper function and associated server routes
1818

19-
xdescribe('Login Tests', () => {
19+
describe('Login Tests', () => {
2020
jest.setTimeout(10000);
2121
let username;
2222
let password;

__tests__/users.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
* @jest-environment node
33
*/
44

5-
// const { Mongoose } = require('mongoose');
6-
// const request = require('supertest');
7-
// const http = require('http');
8-
// const app = require('../server/server.js');
5+
const { Mongoose } = require('mongoose');
6+
const request = require('supertest');
7+
const http = require('http');
8+
const app = require('../server/server.mjs');
99

10-
// const browser = 'http://localhost:8080'; // for checking endpoints accessed with hash router
10+
const browser = 'http://localhost:8080'; // for checking endpoints accessed with hash router
1111

12-
// const { user } = require('../mockData');
12+
const { user } = require('../mockData');
1313

1414
// tests user signup and login routes
15-
xdescribe('User authentication tests', () => {
15+
describe('User authentication tests', () => {
1616
let server;
1717

1818
beforeAll((done) => {

app/src/components/StateManagement/CreateTab/components/StatePropsPanel.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useContext, useEffect } from 'react';
2-
import { styled, Theme } from '@mui/material/styles';
2+
import { Theme } from '@mui/material/styles';
33
import makeStyles from '@mui/styles/makeStyles';
44
import { useDispatch, useSelector } from 'react-redux';
55
import { addState } from '../../../../redux/reducers/slice/appStateSlice';
@@ -12,7 +12,6 @@ import {
1212
TextField,
1313
Button
1414
} from '@mui/material';
15-
import StateContext from '../../../../context/context';
1615
import TableStateProps from './TableStateProps';
1716
import TableParentProps from './TableParentProps';
1817
import TablePassedInProps from './TablePassedInProps';
@@ -39,14 +38,14 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
3938
const [propNum, setPropNum] = useState(1);
4039

4140
// convert value to correct type based on user input
42-
const typeConversion = (value, type) => {
41+
const typeConversion = (value: string, type: string) => {
4342
switch (type) {
4443
case 'string':
4544
return String(value);
4645
case 'number':
4746
return Number(value);
4847
case 'boolean':
49-
return value === 'true' ? true : false;
48+
return value === 'true';
5049
case 'array':
5150
return JSON.parse(value);
5251
case 'object':
@@ -62,10 +61,6 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
6261
setInputValue('');
6362
setInputType('');
6463
};
65-
//reset error warning
66-
const resetError = () => {
67-
setErrorStatus(false);
68-
};
6964

7065
// submit new stateProps entries to state context
7166
const submitNewState = (e) => {
@@ -123,7 +118,7 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
123118
})
124119
);
125120
setRows1([...rows1, newState]);
126-
resetError();
121+
setErrorStatus(false);
127122
clearForm();
128123
};
129124

app/src/components/StateManagement/StateManagement.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import TabContext from '@mui/lab/TabContext';
66
import TabList from '@mui/lab/TabList';
77
import TabPanel from '@mui/lab/TabPanel';
88
import { useSelector } from 'react-redux';
9-
109
import CreateContainer from './CreateTab/CreateContainer';
1110
import DisplayContainer from './DisplayTab/DisplayContainer';
1211

server/models/reactypeModels.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
const mongoose = require('mongoose');
1212
const bcrypt = require('bcryptjs');
1313
require('dotenv').config();
14-
const mongoURI = process.env.MONGO_DB
14+
const mongoURI = process.env.MONGO_DB;
1515
const URI =
1616
process.env.NODE_ENV === 'production' ? mongoURI : process.env.MONGO_DB;
1717

@@ -29,7 +29,7 @@ mongoose
2929
dbName: 'ReacType'
3030
})
3131
.then(() => console.log('Connected to Mongo DB.'))
32-
.catch(err => console.log(err));
32+
.catch((err) => console.log(err));
3333

3434
const { Schema } = mongoose;
3535

server/server.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,4 @@ httpServer.listen(5656, () =>
254254
);
255255

256256
if (isTest) module.exports = app;
257-
// export default app;
257+
export default app;

0 commit comments

Comments
 (0)