Skip to content

Commit

Permalink
added CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alainwelliver committed Apr 14, 2024
1 parent c5b82de commit 98283c7
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 30 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PennLFG CI

on:
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint-test-build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 21
uses: actions/setup-node@v3
with:
node-version: 21
- run: npm install
- run: npm test
- run: npm run lint
- run: npm run build --if-present
12 changes: 6 additions & 6 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1713117562844" clover="3.2.0">
<project timestamp="1713117562844" name="All files">
<metrics statements="142" coveredstatements="99" conditionals="24" coveredconditionals="17" methods="17" coveredmethods="11" elements="183" coveredelements="127" complexity="0" loc="142" ncloc="142" packages="4" files="5" classes="5"/>
<coverage generated="1713120471157" clover="3.2.0">
<project timestamp="1713120471157" name="All files">
<metrics statements="142" coveredstatements="99" conditionals="26" coveredconditionals="19" methods="17" coveredmethods="11" elements="185" coveredelements="129" complexity="0" loc="142" ncloc="142" packages="4" files="5" classes="5"/>
<package name="src.controller">
<metrics statements="43" coveredstatements="37" conditionals="14" coveredconditionals="14" methods="2" coveredmethods="2"/>
<metrics statements="43" coveredstatements="37" conditionals="16" coveredconditionals="16" methods="2" coveredmethods="2"/>
<file name="server.js" path="/Users/alainwelliver/Documents/code-projects/penn-course-projects/sophomore-spring/cis350/Team-8-alain-sem-adam-abhinav-gabe/src/controller/server.js">
<metrics statements="43" coveredstatements="37" conditionals="14" coveredconditionals="14" methods="2" coveredmethods="2"/>
<metrics statements="43" coveredstatements="37" conditionals="16" coveredconditionals="16" methods="2" coveredmethods="2"/>
<line num="1" count="2" type="stmt"/>
<line num="2" count="2" type="stmt"/>
<line num="3" count="2" type="stmt"/>
Expand All @@ -16,7 +16,7 @@
<line num="11" count="2" type="stmt"/>
<line num="14" count="2" type="stmt"/>
<line num="17" count="4" type="stmt"/>
<line num="20" count="4" type="cond" truecount="4" falsecount="0"/>
<line num="20" count="4" type="cond" truecount="6" falsecount="0"/>
<line num="21" count="1" type="stmt"/>
<line num="25" count="3" type="stmt"/>
<line num="26" count="3" type="stmt"/>
Expand Down
2 changes: 1 addition & 1 deletion coverage/coverage-final.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ <h1>All files</h1>


<div class='fl pad1y space-right2'>
<span class="strong">70.83% </span>
<span class="strong">73.07% </span>
<span class="quiet">Branches</span>
<span class='fraction'>17/24</span>
<span class='fraction'>19/26</span>
</div>


Expand Down Expand Up @@ -86,7 +86,7 @@ <h1>All files</h1>
<td data-value="86.04" class="pct high">86.04%</td>
<td data-value="43" class="abs high">37/43</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">14/14</td>
<td data-value="16" class="abs high">16/16</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="86.04" class="pct high">86.04%</td>
Expand Down Expand Up @@ -146,7 +146,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h1><a href="../../../index.html">All files</a> src/controller/controllerUtils</
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../../prettify.js"></script>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ <h1><a href="../../../index.html">All files</a> / <a href="index.html">src/contr
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../../prettify.js"></script>
<script>
Expand Down
6 changes: 3 additions & 3 deletions coverage/lcov-report/src/controller/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1><a href="../../index.html">All files</a> src/controller</h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>14/14</span>
<span class='fraction'>16/16</span>
</div>


Expand Down Expand Up @@ -86,7 +86,7 @@ <h1><a href="../../index.html">All files</a> src/controller</h1>
<td data-value="86.04" class="pct high">86.04%</td>
<td data-value="43" class="abs high">37/43</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">14/14</td>
<td data-value="16" class="abs high">16/16</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="86.04" class="pct high">86.04%</td>
Expand All @@ -101,7 +101,7 @@ <h1><a href="../../index.html">All files</a> src/controller</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
8 changes: 4 additions & 4 deletions coverage/lcov-report/src/controller/server.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/controll
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>14/14</span>
<span class='fraction'>16/16</span>
</div>


Expand Down Expand Up @@ -266,8 +266,8 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/controll
const { username, password, fname, lname } = req.body;
&nbsp;
// check if username and password were inputted
if (!username || !password) {
return res.status(400).json({ error: 'Username and password are required' });
if (!username || !password || !fname || !lname) {
return res.status(400).json({ error: 'Username, password, first name, and last name are required' });
}
&nbsp;
// query the database to see if the username already exists
Expand Down Expand Up @@ -346,7 +346,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/controll
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/src/model/dbUtils.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/model</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/src/model/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1><a href="../../index.html">All files</a> src/model</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/src/model/users.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/model</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h1><a href="../index.html">All files</a> test</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/test/testUtils.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">test</a> testUt
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-14T17:59:22.830Z
at 2024-04-14T18:47:51.141Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
6 changes: 4 additions & 2 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ BRDA:20,0,0,1
BRDA:20,0,1,3
BRDA:20,1,0,4
BRDA:20,1,1,3
BRDA:20,1,2,3
BRDA:20,1,3,3
BRDA:28,2,0,1
BRDA:28,2,1,2
BRDA:58,3,0,1
Expand All @@ -65,8 +67,8 @@ BRDA:66,5,0,1
BRDA:66,5,1,2
BRDA:80,6,0,1
BRDA:80,6,1,1
BRF:14
BRH:14
BRF:16
BRH:16
end_of_record
TN:
SF:src/controller/controllerUtils/jwtAuth.js
Expand Down
4 changes: 2 additions & 2 deletions src/controller/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ app.post('/register', async (req, res) => {
const { username, password, fname, lname } = req.body;

// check if username and password were inputted
if (!username || !password) {
return res.status(400).json({ error: 'Username and password are required' });
if (!username || !password || !fname || !lname) {
return res.status(400).json({ error: 'Username, password, first name, and last name are required' });
}

// query the database to see if the username already exists
Expand Down
2 changes: 1 addition & 1 deletion test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("API endpoint testing", () => {
.expect(400);
});

it("should fail with 409 if username already exists", async () => {
it("should fail with 401 if username already exists", async () => {
// Assuming the user from the first test already exists
const response = await request(app)
.post('/register')
Expand Down

0 comments on commit 98283c7

Please sign in to comment.