More fixes to file structure

This commit is contained in:
Lucas Patenaude
2024-04-30 18:27:03 -06:00
parent fad077870f
commit 1554f67a16
54 changed files with 3 additions and 3 deletions

View File

@@ -31,8 +31,8 @@ services:
ports:
- '3000:3000'
volumes:
- ../ProjectSourceCode:/home/node/app # Mount ProjectSourceCode directory
- ../ProjectSourceCode/node_modules:/home/node/app/node_modules # Mount node_modules directory
- ../client:/home/node/app # Mount ProjectSourceCode directory
- ../client/node_modules:/home/node/app/node_modules # Mount node_modules directory
command: 'npm run start'
volumes:
group-project:

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 127 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,118 +0,0 @@
// ********************** Initialize server **********************************
const server = require('../src/index.js'); //TODO: Make sure the path to your index.js is correctly added
// ********************** Import Libraries ***********************************
const chai = require('chai'); // Chai HTTP provides an interface for live integration testing of the API's.
const chaiHttp = require('chai-http');
chai.should();
chai.use(chaiHttp);
const {assert, expect} = chai;
// ********************** DEFAULT WELCOME TESTCASE ****************************
describe('Server!', () => {
// Sample test case given to test / endpoint.
it('Returns the default welcome message', done => {
chai
.request(server)
.get('/welcome')
.end((err, res) => {
expect(res).to.have.status(200);
expect(res.body.status).to.equals('success');
assert.strictEqual(res.body.message, 'Welcome!');
done();
});
});
});
// *********************** TODO: WRITE 2 UNIT TESTCASES **************************
// ********************************************************************************
describe('Testing Add User API', () => {
it('positive: /register', done => {
// Define mock user data
const userData = {
username: 'Test User',
password: '123456'
};
// Make a POST request to /register with mock user data
chai.request(server)
.post('/register')
.send(userData)
.end((err, res) => {
// Assertions
expect(res).to.have.status(200);
done();
});
});
});
//We are checking POST /add_user API by passing the user info in in incorrect manner (name cannot be an integer). This test case should pass and return a status 400 along with a "Invalid input" message.
describe('Testing Add User API', () => {
it('Negative: /register. Checking invalid name', done => {
chai.request(server)
.post('/register')
.send({ Username: 10, Password: '2020-02-20'})
.end((err, res) => {
// Assertions
expect(res).to.have.status(400);
expect(res.body.message).to.equals('Invalid input');
done();
});
});
});
describe('Testing Render', () => {
// Sample test case given to test /test endpoint.
it('test "/login" route should render with an html response', done => {
chai
.request(server)
.get('/login') // for reference, see lab 8's login route (/login) which renders home.hbs
.end((err, res) => {
res.should.have.status(200); // Expecting a success status code
res.should.be.html; // Expecting a HTML response
done();
});
});
});
var cookies;
describe('Login', () => {
// Sample test case given to test /login endpoint.
it('Returns the default welcome message', done => {
chai
.request(server)
.get('/login')
.end((err, res) => {
if (res.headers['set-cookie']) {
// Save the cookies
cookies = res.headers['set-cookie'].pop().split(';')[0];
} else {
cookies = null;
}
done();
});
});
});
describe('Home', () => {
// Sample test case given to test /login endpoint.
it('Returns the default welcome message', done => {
chai
.request(server)
.get('/home')
.end((err, res) => {
if (res.headers['set-cookie']) {
// Save the cookies
cookies = res.headers['set-cookie'].pop().split(';')[0];
} else {
cookies = null;
}
done();
});
});
});