Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding new tests, trying to fail upload #65

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ jobs:
- name: Upload dummy file to Codecov
run: ./codecov upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n dummy-${{ github.run_id }} -F dummy -f dummy-file.txt

- name: Trigger notifications
run: ./codecov send-notifications -t ${{ secrets.CODECOV_TOKEN }}
# - name: Trigger notifications
# run: ./codecov send-notifications -t ${{ secrets.CODECOV_TOKEN }}

2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ coverage:

codecov:
notify:
manual_trigger: true
# manual_trigger: true
notify_error: true

github_checks: #does not work if flags are configured
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"testEnvironment": "jsdom",
"collectCoverage": true,
"coverageReporters": [
"json", "html"
"json",
"html"
]
}
}
}
24 changes: 24 additions & 0 deletions resources/js/classes/calculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// FILE: resources/js/calculator.js

class Calculator {
add(a, b) {
return a + b;
}

subtract(a, b) {
return a - b;
}

multiply(a, b) {
return a * b;
}

divide(a, b) {
if (b === 0) {
throw new Error("Division by zero");
}
return a / b;
}
}

module.exports = Calculator;
28 changes: 28 additions & 0 deletions resources/js/classes/calculator.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// FILE: resources/js/calculator.test.js

const Calculator = require('./calculator');

test('adds 1 + 2 to equal 3', () => {
const calculator = new Calculator();
expect(calculator.add(1, 2)).toBe(3);
});

test('subtracts 5 - 2 to equal 3', () => {
const calculator = new Calculator();
expect(calculator.subtract(5, 2)).toBe(3);
});

test('multiplies 3 * 4 to equal 12', () => {
const calculator = new Calculator();
expect(calculator.multiply(3, 4)).toBe(12);
});

test('divides 8 / 2 to equal 4', () => {
const calculator = new Calculator();
expect(calculator.divide(8, 2)).toBe(4);
});

test('divides by zero to throw error', () => {
const calculator = new Calculator();
expect(() => calculator.divide(8, 0)).toThrow('Division by zero');
});
Loading