Skip to content

Commit

Permalink
Merge pull request #118 from Arquisoft/Test-views
Browse files Browse the repository at this point in the history
Test views
  • Loading branch information
Pablo-ArgF authored Apr 11, 2023
2 parents c5d0e06 + d80ec4a commit 79cd1df
Show file tree
Hide file tree
Showing 26 changed files with 822 additions and 240 deletions.
19 changes: 2 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@ jobs:
working-directory: webapp
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test --coverage --watchAll
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
unit-test-restapi:
runs-on: ubuntu-latest
defaults:
run:
working-directory: restapi
steps:
- uses: actions/checkout@v3
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -42,7 +27,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
needs: [unit-test-webapp, unit-test-restapi]
needs: [unit-test-webapp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
34 changes: 1 addition & 33 deletions .github/workflows/lomap_en2a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
unit-test-restapi:
runs-on: ubuntu-latest
defaults:
run:
working-directory: restapi
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test --coverage --watchAll
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
needs: [unit-test-webapp, unit-test-restapi]
needs: [unit-test-webapp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --prefix webapp install
- run: npm --prefix restapi install
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
Expand All @@ -68,20 +50,6 @@ jobs:
registry: ghcr.io
workdir: webapp
buildargs: API_URI
docker-push-restapi:
name: Push restapi Docker Image to GitHub Packages
runs-on: ubuntu-latest
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/lomap_en2a/restapi
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: restapi
# deploy:
# name: Deploy over SSH
# runs-on: ubuntu-latest
Expand Down
50 changes: 0 additions & 50 deletions restapi/tests/api.test.ts

This file was deleted.

1 change: 1 addition & 0 deletions webapp/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testEnvironment: 'jsdom',
}
79 changes: 0 additions & 79 deletions webapp/loadtestexample/GetUsersList.scala

This file was deleted.

1 change: 0 additions & 1 deletion webapp/loadtestexample/getuserslist/0004_request.txt

This file was deleted.

34 changes: 23 additions & 11 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"react-slick": "^0.29.0",
"shortid": "^2.2.16",
"solid-auth-client": "^2.5.6",
"text-encoding": "^0.7.0",
"typescript": "^4.9.4",
"uuidv4": "^6.2.13",
"web-vitals": "^2.1.2"
Expand All @@ -34,7 +35,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --coverage",
"test:e2e": "start-server-and-test 'npm --prefix ../restapi start' http://localhost:5000/api/users/list prod 3000 \"cd e2e && jest\"",
"test:e2e": "start-server-and-test prod 3000 \"cd e2e && jest\"",
"eject": "react-scripts eject",
"prod": "ts-node-dev ./server.ts"
},
Expand Down
9 changes: 0 additions & 9 deletions webapp/src/App.test.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions webapp/src/components/AddLocationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ function AddLocationFormComp(props : AddLocationProps) : JSX.Element {
<MenuList minWidth='240px'>
<MenuOptionGroup type='checkbox'>
{
categories.map((kind) => { // as many possible categories as items in Category enum
categories.map((kind,i) => { // as many possible categories as items in Category enum
return (
<MenuItemOption value={kind} onClick={(e) => handleCheckedCategory(e)}
<MenuItemOption key={i} value={kind} onClick={(e) => handleCheckedCategory(e)}
>{kind}</MenuItemOption>
)
})
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/Friends.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function Friends() : JSX.Element {

<form onSubmit={handleSubmitSolid} >
<InputGroup>
<Input placeholder='Friend URL' type='text' id="newFriend" name="newFriend"required/>
<Input data-testid ='inputFriends' placeholder='Friend URL' type='text' id="newFriend" name="newFriend"required/>
<InputRightElement>
<Button type='submit'>+</Button>
</InputRightElement>
Expand Down
10 changes: 10 additions & 0 deletions webapp/src/components/FriendsDetail.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { render } from "@testing-library/react";
import FriendsDetail from "./FriendsDetail";
import { Friend } from '../../../restapi/users/User';

test('check username renders correctly',async () => {
let user : Friend = {username:String("username"), webID:String("webID"), pfp:""}
const {getByText}= render(<FriendsDetail friend={user} key={1}></FriendsDetail>)
expect(getByText(user.username as string)).toBeInTheDocument();
})
Loading

0 comments on commit 79cd1df

Please sign in to comment.