Skip to content

Commit

Permalink
[ CURRICULUM ][ WEEK 01 ] Added GitHub actions for 1st JS exercise test
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasx committed Oct 4, 2023
1 parent e8ddd8f commit 923caf9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/w01-d05.yaml
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
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)

});

0 comments on commit 923caf9

Please sign in to comment.