Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladrillo committed May 11, 2023
1 parent c20f69f commit cb95c72
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 112 deletions.
64 changes: 32 additions & 32 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions backend/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function getMentors(req, res, ctx) {
}

const handlers = [
rest.get('http://localhost:3001/api/learners', getLearners),
rest.get('http://localhost:3001/api/mentors', getMentors),
rest.get('http://localhost:3003/api/learners', getLearners),
rest.get('http://localhost:3003/api/mentors', getMentors),
rest.get('/api/learners', getLearners),
rest.get('/api/mentors', getMentors),
]
Expand Down
4 changes: 2 additions & 2 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { learners, mentors } = require('./data')

const delay = 500
const server = express()
const port = process.env.PORT || 3001
const port = process.env.PORT || 3003

server.use(express.json())
server.use(express.static(path.join(__dirname, '../frontend')))
Expand Down Expand Up @@ -49,7 +49,7 @@ server.use((err, req, res, next) => { // eslint-disable-line
server.listen(port, () => {
console.log(`
-------------------------------------------------------------------------
See YOUR PROJECT in the browser, navigating to --> http://localhost:3001
See YOUR PROJECT in the browser, navigating to --> http://localhost:3003
See the live mock navigating to --> https://w-s5-challenge.herokuapp.com/
-------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
DO NOT CHANGE THIS FILE
DO NOT CHANGE THIS FILE
DO NOT CHANGE THIS FILE
DO NOT CHANGE THIS FILE
DO NOT CHANGE THIS FILE
DO NOT CHANGE THIS FILE
-->
<!DOCTYPE html>
<html lang="en">
Expand Down
17 changes: 7 additions & 10 deletions frontend/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
async function sprintChallenge5() {
// 👇 WORK WORK BELOW THIS LINE 👇

const footer = document.querySelector('footer')
const currentYear = new Date().getFullYear()
footer.textContent = `© BLOOM INSTITUTE OF TECHNOLOGY ${currentYear}`

// 👇 WORK WORK BELOW THIS LINE 👇


// 👆 WORK WORK ABOVE THIS LINE 👆
}

// ❗ DO NOT CHANGE THE CODE BELOW
sprintChallenge5()
// This try/catch is needed to expose the sprintChallenge5 function to the test runner
try { module.exports = { sprintChallenge5 } } catch {
// module.exports does not exist in the browser
// so this is always a crash in Chrome
}
// ❗ DO NOT CHANGE THE CODE BELOW
// ❗ DO NOT CHANGE THE CODE BELOW
// ❗ DO NOT CHANGE THE CODE BELOW
if (typeof module !== 'undefined' && module.exports) module.exports = { sprintChallenge5 }
else sprintChallenge5()
6 changes: 3 additions & 3 deletions frontend/reset.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */

/* RESET BY https://www.joshwcomeau.com/css/custom-css-reset */
*,
Expand Down
6 changes: 3 additions & 3 deletions frontend/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
/* DO NOT CHANGE THIS FILE */
@font-face {
font-family: 'Titillium Web';
src: url('./TitilliumWeb.ttf');
Expand Down
12 changes: 1 addition & 11 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,7 @@ module.exports = {
</head>
<body>
<header>
<h1>Sprint 5 Challenge Submission</h1>
<h2>Learner Cards</h2>
<p class="info">Fetching learner cards...</p>
</header>
<section>
<div class="cards">
<!-- Learner cards are injected here by index.js script -->
</div>
</section>
<footer></footer>
<!-- body contents injected beforEach test -->
</body>
</html>
Expand Down
7 changes: 3 additions & 4 deletions mvp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const waitForOptions = { timeout: 150 } // so Codegrade does not take forever

beforeAll(() => { server.listen() })
afterAll(() => { server.close() })
beforeEach(async () => { await sprintChallenge5() })
afterEach(() => {
beforeEach(async () => {
document.querySelector('body').innerHTML = `
<header>
<h1>Sprint 5 Challenge Submission</h1>
Expand All @@ -22,8 +21,8 @@ afterEach(() => {
<!-- Learner cards are injected here by index.js script -->
</div>
</section>
<footer></footer>
`
<footer></footer>`
await sprintChallenge5()
})

async function firstCardRender() {
Expand Down
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "solution",
"name": "w_s5_challenge",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "fkill :3001 -s && node ./backend/server.js",
"test": "cross-env NODE_ENV=testing jest --watchAll --verbose"
"start": "fkill :3003 -s && node ./backend/server.js",
"test": "cross-env NODE_ENV=testing jest --watchAll --verbose",
"fixit": "rm -rf node_modules package-lock.json && npm cache clean --force && npm i"
},
"license": "MIT",
"devDependencies": {
"@testing-library/dom": "^9.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@types/jest": "^29.5.1",
"cross-env": "^7.0.3",
"eslint": "^8.39.0",
"eslint": "^8.40.0",
"fkill-cli": "^7.1.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
Expand Down

0 comments on commit cb95c72

Please sign in to comment.