Skip to content

Commit

Permalink
Merge pull request #53 from vlad-ko/feature/adding-new-functions
Browse files Browse the repository at this point in the history
Added new code and tests
  • Loading branch information
vlad-ko authored Jun 20, 2024
2 parents 072f38b + c04e8f0 commit 4272f59
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/pr-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,19 @@ jobs:
run: vendor/bin/phpunit --testsuite="Controllers Tests" --coverage-clover=coverage-controller.xml

- name: Upload Controller coverage report
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'controller'-${{ github.run_id }} -F controller -f coverage-service.xml
run: ./codecov upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n 'controller'-${{ github.run_id }} -F controller -f coverage-controller.xml

- name: Run Unit Testsuite with Coverage
run: vendor/bin/phpunit --testsuite="Unit Tests" --coverage-clover=coverage-unit.xml

- name: Upload unit coverage report
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'unit'-${{ github.run_id }} -F unit -f coverage-unit.xml

- name: Run Complete Testsuite with Coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml
run: ./codecov upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n 'unit'-${{ github.run_id }} -F unit -f coverage-unit.xml

- name: Javascript tests using Jest
run: npm run test

- name: Upload Javascript coverage
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'javascript'-${{ github.run_id }} -F 'javascript' -f coverage/coverage-final.json
run: ./codecov upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n 'javascript'-${{ github.run_id }} -F 'javascript' -f coverage/coverage-final.json

- name: Trigger notifications
run: ./codecov send-notifications -t ${{ secrets.CODECOV_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions app/Models/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ public function uncoveredFunction() {
public function returnSeventySix() {
return 76;
}

public function returnDataSet() {
return 'data set';
}
}
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ component_management:
name: "backend"
paths:
- ".*"
flag_regexes: # List. Flags to be included in the component.
flag_regexes: # List of lags to be included in the component.
- "unit"
- "controller"
- "service"
Expand Down
4 changes: 4 additions & 0 deletions resources/js/classes/person.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ test("Person class", ()=>{

test("Person class", ()=>{
expect(person.getMenuOptions()).toBe('menu options');
})

test("Person class", ()=>{
expect(person.getPersonalData()).toBe('secret data');
})
7 changes: 7 additions & 0 deletions tests/Unit/ChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ public function testReturnSeventySix() {
$result = $charge->returnSeventySix();
$this->assertEquals(76, $result);
}

public function testReturnDataSet() {

$charge = Charge::factory()->make();
$result = $charge->returnDataSet();
$this->assertEquals('data set', $result);
}
}

0 comments on commit 4272f59

Please sign in to comment.