Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
624bea5
added .idea (webstorm generated codespace files) to gitignore
cjmot Jan 12, 2026
360f509
Fill in notes.md for first deliverable
cjmot Jan 14, 2026
96282ee
Create test.yml
cjmot Jan 14, 2026
baec78b
Add CI Pipeline file
cjmot Jan 14, 2026
2f8581c
Update ci.yml for github pages exercise
cjmot Jan 14, 2026
ed43ed6
Update ci pipeline to deploy jwt-pizza
cjmot Jan 15, 2026
7359406
Add CI pipeline badge to README
cjmot Jan 15, 2026
d5c6d7d
Update CI Pipeline badge in README.md
cjmot Jan 16, 2026
6963d3a
Playwright install
cjmot Feb 3, 2026
6f3ddb8
Merge remote-tracking branch 'origin/main'
cjmot Feb 3, 2026
a7e2089
Update ci and readme
cjmot Feb 3, 2026
61890c1
Add testing plugins and basic test
cjmot Feb 8, 2026
af9847c
Reconfigure playwright, update prettier and env
cjmot Feb 9, 2026
4fcf9fa
Add auth tests and static ui tests
cjmot Feb 9, 2026
1064724
moved basicInit to a helper file
cjmot Feb 10, 2026
a76b79c
add tests for creating and closing franchises and stores
cjmot Feb 10, 2026
5f117ca
more tests for deleting and creating stores
cjmot Feb 10, 2026
6fe0afa
remove console logs
cjmot Feb 10, 2026
2220aa9
updated comments
cjmot Feb 10, 2026
780907f
add tests for franchisee functions
cjmot Feb 10, 2026
bd67718
add docs to ui test
cjmot Feb 10, 2026
c986538
add register test
cjmot Feb 10, 2026
85e19a6
add register test
cjmot Feb 10, 2026
b6d0dce
Merge remote-tracking branch 'origin/user-interface-testing' into use…
cjmot Feb 10, 2026
2cd2dd8
update coverage badge in README.md
cjmot Feb 10, 2026
9521bfa
Merge pull request #1 from cjmot/user-interface-testing
cjmot Feb 10, 2026
ca8f535
Update README.md
cjmot Feb 10, 2026
218c298
prettier reformat
cjmot Feb 10, 2026
049b8c4
Merge branch 'main' into user-interface-testing
cjmot Feb 10, 2026
0a68896
Merge pull request #2 from cjmot/user-interface-testing
cjmot Feb 10, 2026
2c6a44c
Update README.md
cjmot Feb 10, 2026
5d43e0c
Update README.md (again)
cjmot Feb 10, 2026
403ad77
Update README.md
cjmot Feb 10, 2026
b6137e4
update ci to deploy to aws
cjmot Feb 19, 2026
39ad4d5
tdd before first test fail
cjmot Feb 21, 2026
11e6c0a
update user interface to include editUser form
cjmot Feb 21, 2026
67e10cb
Updated ci pipelines
cjmot Feb 21, 2026
7e8d058
renamed test pipline to tests
cjmot Feb 21, 2026
858fd6a
added more tests for updateUser, added better message handling for in…
cjmot Feb 21, 2026
292a930
Add listUsers mock and listUsers service route
cjmot Feb 22, 2026
f99c7c0
add listUsers tests and list users admin dashboard functionality
cjmot Feb 22, 2026
b52de22
add deleteUser route and type
cjmot Feb 22, 2026
ba46ec4
add deleteUser component and route for a user deletion confirmation
cjmot Feb 22, 2026
d61966c
add deleteUser route to app.tsx
cjmot Feb 22, 2026
6f7d224
add deleteUser button and tests for user deletion functionality
cjmot Feb 22, 2026
17ed2e4
fix admin test error
cjmot Feb 22, 2026
79f5034
update tests ci to only trigger on pull requests to main or workflow …
cjmot Feb 22, 2026
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
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_PIZZA_SERVICE_URL=http://localhost:3000
VITE_PIZZA_FACTORY_URL=https://pizza-factory.cs329.click
VITE_PIZZA_FACTORY_URL=https://pizza-factory.cs329.click
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI Pipeline

on:
push:
branches:
- main
- user-interface-testing
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: set version
id: set_version
run: |
version=$(date +'%Y%m%d.%H%M%S')
echo "version=$version" >> "$GITHUB_OUTPUT"
printf '{"version": "%s" }' "$version" > public/version.json

- name: Build
run: |
npm ci && npm run build

- name: Run tests
run: |
npx playwright install --with-deps chromium
npm run test:coverage

- name: Update coverage
run: |
coverage=$(jq '.total.lines.pct' coverage/coverage-summary.json)
color=$(echo "$coverage < 80" | bc | awk '{if ($1) print "red"; else print "green"}')
curl -s -X POST "https://pizza-factory.cs329.click/api/badge/${{ secrets.NET_ID }}/jwtpizzacoverage?label=Coverage&value=$coverage%25&color=$color" -H "authorization: bearer ${{ secrets.FACTORY_API_KEY }}"

- name: Update dist artifact
uses: actions/upload-artifact@v4
with:
name: package
path: dist/
deploy:
needs: build
permissions:
id-token: write
runs-on: ubuntu-latest
env:
version: ${{needs.build.outputs.version}}
steps:
- name: Create OIDC token to AWS
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/${{ secrets.CI_IAM_ROLE }}

- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: package
path: dist/

- name: Push to AWS S3
run: |
echo Deploying $version
aws s3 cp dist s3://${{ secrets.APP_BUCKET }} --recursive
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*"
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: tests

on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: set version
id: set_version
run: |
version=$(date +'%Y%m%d.%H%M%S')
echo "version=$version" >> "$GITHUB_OUTPUT"
printf '{"version": "%s" }' "$version" > public/version.json

- name: Build
run: |
npm ci && npm run build

- name: Run tests
run: |
npx playwright install --with-deps chromium
npm run test:coverage
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ config.js
coverage
dist
**/.vite
.idea

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
.nyc_output
7 changes: 7 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"check-coverage": true,
"branches": 0,
"lines": 80,
"functions": 0,
"statements": 0
}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"printWidth": 100,
"tabWidth": 4,
"trailingComma": "all"
}
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# 🍕 JWT Pizza

![Coverage badge](https://pizza-factory.cs329.click/api/badge/accountId/jwtpizzacoverage?t=1)
![Coverage badge](https://pizza-factory.cs329.click/api/badge/cjmotyer/jwtpizzacoverage)
[![CI Pipeline](https://github.com/cjmot/jwt-pizza/actions/workflows/ci.yml/badge.svg)](https://github.com/cjmot/jwt-pizza/actions/workflows/ci.yml)

A JSON Web Token, or [JWT](https://jwt.io/introduction), (pronounced JOT) is a digitally signed transfer of information using JSON notation. Because you can validate the digital signature you can buy JWT pizzas with confidence.
A JSON Web Token, or [JWT](https://jwt.io/introduction), (pronounced JOT) is a digitally signed transfer of information
using JSON notation. Because you can validate the digital signature you can buy JWT pizzas with confidence.

`JWT Pizza` takes the next stage of digital evolution by allowing you to buy pizzas that you can never actually eat. Not only does JWT exchange bitcoin and give you nothing in return, it also allows for you to be come a franchisee and turn the whole vapor company into an MLM.
`JWT Pizza` takes the next stage of digital evolution by allowing you to buy pizzas that you can never actually eat. Not
only does JWT exchange bitcoin and give you nothing in return, it also allows for you to be come a franchisee and turn
the whole vapor company into an MLM.

You can see a working example of the application at [pizza.cs329.click](https://pizza.cs329.click)

Expand All @@ -30,7 +34,8 @@ You can see a working example of the application at [pizza.cs329.click](https://

## Development notes

JWT Pizza uses Vite, React, Tailwind, and Preline. The following contains some notes about how these components were integrated into the project.
JWT Pizza uses Vite, React, Tailwind, and Preline. The following contains some notes about how these components were
integrated into the project.

### Vite

Expand All @@ -45,15 +50,16 @@ Modify `package.json`

```json
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
```

### React

React works out of the box with Vite, but we do need to install the desired React packages. The `index.html` file loads `index.jsx` which then loads the app component (`src/app.jsx`).
React works out of the box with Vite, but we do need to install the desired React packages. The `index.html` file loads
`index.jsx` which then loads the app component (`src/app.jsx`).

```sh
npm install react react-dom react-router-dom
Expand All @@ -73,11 +79,11 @@ Modify `tailwind.config.js`
```js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['index.html', './src/**/*.{html,js,jsx}'],
theme: {
extend: {},
},
plugins: [],
content: ['index.html', './src/**/*.{html,js,jsx}'],
theme: {
extend: {},
},
plugins: [],
};
```

Expand All @@ -92,17 +98,19 @@ Create a `main.css` and add the basic Tailwind directives.
Modify `index.html` to include tailwind output.css.

```html

<head>
...
<link href="./main.css" rel="stylesheet" />
...
<link href="./main.css" rel="stylesheet"/>
</head>
```

Now when you run with `npm run dev` the css will automatically be generated.

### Preline

Added the Tailwind [Preline component library](https://preline.co/) so that I can use all of their nifty nav, slideshow, containers, and cards.
Added the Tailwind [Preline component library](https://preline.co/) so that I can use all of their nifty nav, slideshow,
containers, and cards.

```sh
npm i preline
Expand All @@ -114,15 +122,15 @@ Updated the tailwind config to use preline.
const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
content: ['index.html', './src/**/*.{html,js,jsx}', './node_modules/preline/preline.js'],
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
content: ['index.html', './src/**/*.{html,js,jsx}', './node_modules/preline/preline.js'],
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
},
},
},
plugins: [require('preline/plugin')],
plugins: [require('preline/plugin')],
};
```

Expand All @@ -135,15 +143,15 @@ import 'preline/preline';
Initialize components whenever the page location changes.

```js
import { useLocation, Routes, Route, NavLink } from 'react-router-dom';
import {useLocation, Routes, Route, NavLink} from 'react-router-dom';

export default function App() {
const location = useLocation();
const location = useLocation();

useEffect(() => {
window.HSStaticMethods.autoInit();
}, [location.pathname]);
//...
useEffect(() => {
window.HSStaticMethods.autoInit();
}, [location.pathname]);
//...
```

### Icons
Expand Down
Loading