Skip to content
Merged
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
100 changes: 100 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Full Stack CI

on:
push:
branches:
- main
- 'ci*'
pull_request:
branches:
- main
- 'ci*'

jobs:
test-api-linux:
name: API Test (Linux)
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- uses: actions/checkout@v4
- run: ls -l api/package-lock.json
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: api/package-lock.json
- run: npm ci
working-directory: api
- run: npm test
working-directory: api

test-frontend-linux:
name: Frontend Test (Linux)
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- uses: actions/checkout@v4
- run: ls -l front-end/package-lock.json
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: front-end/package-lock.json
- run: npm ci
working-directory: front-end
- run: npm test
working-directory: front-end

test-api-windows:
name: API Test (Windows)
runs-on: windows-latest

strategy:
matrix:
node-version: [22.x]

steps:
- uses: actions/checkout@v4
- run: dir api\package-lock.json
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: api/package-lock.json
- run: npm ci
working-directory: api
- run: npm test
working-directory: api

test-frontend-windows:
name: Frontend Test (Windows)
runs-on: windows-latest

strategy:
matrix:
node-version: [22.x]

steps:
- uses: actions/checkout@v4
- run: dir front-end\package-lock.json
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: front-end/package-lock.json
- run: npm ci
working-directory: front-end
- run: npm test
working-directory: front-end
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "echo \"No tests yet\"",
"backend": "nodemon server.js "
},
"nodemonConfig": {
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function App() {


return (
<div className="App">
<div className="App" data-testid="testApp">
<Navbar></Navbar>
{/* <div className='sidebar-container'>
<div class="btn-group-horizontal" role="group" aria-label="Vertical radio toggle button group">
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
const linkElement = screen.getByTestId('testApp');
expect(linkElement).toBeInTheDocument();
});