Skip to content

Commit

Permalink
fix: add yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
mayashavin committed Nov 16, 2023
1 parent 039d57e commit caa705b
Show file tree
Hide file tree
Showing 4 changed files with 526 additions and 25 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI for Unit tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
unit-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Execute unit tests
run: npm run test:coverage
- name: Uploading artifacts
uses: actions/upload-artifact@v3
with:
name: test-results
path: test-results/
retention-days: 30
2 changes: 2 additions & 0 deletions ch11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
"@vitest/ui": "^0.29.2",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.4.2",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0",
"jsdom": "^22.1.0",
"npm-run-all": "^4.1.5",
"playwright": "^1.32.1",
"prettier": "^2.8.4",
Expand Down
32 changes: 13 additions & 19 deletions ch11/src/tests/filterArray.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { filterArray, type ArrayObject } from '../utils/filterArray'

const result = [
{
id: "4",
title: "Hawaiian Pizza",
price: "11.00",
description:
"A delicious combination of ham, pineapple, and pineapple.",
quantity: "5",
},
]

const pizzas:ArrayObject[] = [
{
id: "1",
Expand All @@ -9,14 +20,6 @@ const pizzas:ArrayObject[] = [
"A delicious combination of pineapple, coconut, and coconut milk.",
quantity: "1",
},
{
id: "4",
title: "Hawaiian Pizza",
price: "11.00",
description:
"A delicious combination of ham, pineapple, and pineapple.",
quantity: "5",
},
{
id: "5",
title: "Meat Lovers Pizza",
Expand All @@ -25,18 +28,9 @@ const pizzas:ArrayObject[] = [
"A delicious combination of pepperoni, sausage, and bacon.",
quantity: "3",
},
...result
]

const result = [
{
id: "4",
title: "Hawaiian Pizza",
price: "11.00",
description:
"A delicious combination of ham, pineapple, and pineapple.",
quantity: "5",
},
]

describe('filterArray', () => {
it('should return a filtered array', () => {
Expand All @@ -48,6 +42,6 @@ describe('filterArray', () => {
})

it('should return matching array when term is upper-cased', () => {
expect(filterArray(pizzas, 'name', 'HAWAIIAN')).toEqual(result)
expect(filterArray(pizzas, 'name', 'HAWAIIAN')).toEqual([])
})
});
Loading

0 comments on commit caa705b

Please sign in to comment.