-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ CURRICULUM ][ WEEK 01 ] Added GitHub actions for 1st JS exercise test
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Tests for Week01 Day05 | ||
|
||
on: push | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
# Trigger word 'javascript-largest-number' | ||
if: contains(github.event.head_commit.message, 'javascript-largest-number') | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: node curriculum/week01/exercises/javascript-first-steps/tests/largest-number.test.js |
25 changes: 25 additions & 0 deletions
25
curriculum/week01/exercises/javascript-first-steps/tests/largest-number.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const test = require('node:test'); | ||
const assert = require('assert') | ||
|
||
try { | ||
|
||
require("../../../../../user/week01/exercises/day05/javascript-first-steps/largest-number"); | ||
|
||
} catch(e){ | ||
|
||
throw new Error("Could not find exercise solution at the user/ folder. Please check if you have used the correct folder path and commit message"); | ||
|
||
} | ||
|
||
test('should find the max number', () => { | ||
|
||
const checkMax1 = findMaxNumber(10, 5); | ||
const checkMax2 = findMaxNumber(10, 15); | ||
const checkMax3 = findMaxNumber(100, 100); | ||
|
||
assert.equal(checkMax1, 10) | ||
assert.equal(checkMax2, 15) | ||
assert.equal(checkMax3, 100) | ||
|
||
}); | ||
|