Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to master #26

Merged
merged 104 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
4cab639
add README
Firebird1029 Feb 24, 2024
4321233
Merge branch 'dev' into brandon
Firebird1029 Feb 24, 2024
e6d251d
Create backend.t.js
davidcrair Feb 26, 2024
bc218cd
remove old tests, update test script
Firebird1029 Feb 29, 2024
608145d
add lint-staged
Firebird1029 Feb 29, 2024
e152de9
fix lint-staged
Firebird1029 Feb 29, 2024
1f8fdc7
test lint-staged
Firebird1029 Feb 29, 2024
be4647f
update gitignore for lint-staged
Firebird1029 Feb 29, 2024
c4868ee
update Github Action lint script
Firebird1029 Feb 29, 2024
b02bc3e
Merge branch 'dev' into brandon
Firebird1029 Feb 29, 2024
6b8892b
update lint script
Firebird1029 Feb 29, 2024
e54b007
update linting again
Firebird1029 Feb 29, 2024
ee778b9
update all Github Action triggers
Firebird1029 Feb 29, 2024
0ed576e
Update page.jsx
davidcrair Feb 29, 2024
b70ac23
Update Index.jsx
davidcrair Feb 29, 2024
07b9417
[Github Actions] lint files
davidcrair Feb 29, 2024
a032702
Merge pull request #15 from Firebird1029/brandon
rcheng11 Mar 4, 2024
e172dc5
remove old tests, update test script
Firebird1029 Feb 29, 2024
49c591f
add lint-staged
Firebird1029 Feb 29, 2024
9813e85
fix lint-staged
Firebird1029 Feb 29, 2024
080243a
test lint-staged
Firebird1029 Feb 29, 2024
0b9e5e1
update gitignore for lint-staged
Firebird1029 Feb 29, 2024
71161a3
update Github Action lint script
Firebird1029 Feb 29, 2024
d3e71f9
update lint script
Firebird1029 Feb 29, 2024
92f2d6a
update linting again
Firebird1029 Feb 29, 2024
aedb725
update all Github Action triggers
Firebird1029 Feb 29, 2024
dc57537
fix ESLint errors
Firebird1029 Mar 4, 2024
f2927dc
update ESLint rules
Firebird1029 Mar 4, 2024
fcd70be
fix all ESLInt issues
Firebird1029 Mar 4, 2024
c0eb2ef
remove typescript from linting
Firebird1029 Mar 4, 2024
a2c7fb3
Merge pull request #16 from Firebird1029/fix-eslint-3-3
Firebird1029 Mar 4, 2024
9d55aab
Changed user login
davidcrair Mar 4, 2024
9e1b9f0
Merge branch 'dev' into new-login
davidcrair Mar 4, 2024
781a881
fix ESLint errors
Firebird1029 Mar 4, 2024
bbe0eb9
Merge pull request #17 from Firebird1029/new-login
davidcrair Mar 4, 2024
4558f0d
fix frontend tests
Firebird1029 Mar 7, 2024
a0e19a5
fix Github Actions name
Firebird1029 Mar 7, 2024
ad75f75
Merge pull request #18 from Firebird1029/add-frontend-tests-3-7
Firebird1029 Mar 7, 2024
da3f20d
Changed index page
davidcrair Mar 10, 2024
c09206f
Update Index.jsx
davidcrair Mar 10, 2024
f336161
updated user page
davidcrair Mar 10, 2024
dc42802
Rewrote HomeContent.jsx + server.js
hoixw Mar 12, 2024
f1cd000
fixed eslint errors
hoixw Mar 12, 2024
c043a56
Merge pull request #19 from Firebird1029/sachin
davidcrair Mar 12, 2024
664229c
Updated user content
davidcrair Mar 13, 2024
4c4e665
Added share
davidcrair Mar 13, 2024
0fe65f8
Made share cassette work
davidcrair Mar 13, 2024
4f26f3c
Added radar chart to HomeContent
hoixw Mar 13, 2024
8120c98
Merge pull request #20 from Firebird1029/sachin
davidcrair Mar 14, 2024
be5014d
Merge branch 'dev' into figma_svg
davidcrair Mar 14, 2024
5a95df4
Merge branch 'dev' into figma_svg
davidcrair Mar 14, 2024
ed81a66
Change to tailwind and add radar
davidcrair Mar 14, 2024
0b3d711
remove unnecessary Github Action steps
Firebird1029 Mar 18, 2024
fb18d56
rename server/ to api/
Firebird1029 Mar 18, 2024
dc62b5c
add concurrently
Firebird1029 Mar 18, 2024
17e7f61
switch fetch to axios
Firebird1029 Mar 19, 2024
152ea44
switch fetch to axios
Firebird1029 Mar 19, 2024
20a4f27
Working spotify palette share feature
davidcrair Feb 19, 2024
30be5c2
Removed old file and eslint fix
davidcrair Feb 26, 2024
03f6f4b
Merge branch 'figma_svg' into add-supabase
Firebird1029 Mar 19, 2024
6b21993
comment out console logs
Firebird1029 Mar 19, 2024
fc8386b
update package-lock (?)
Firebird1029 Mar 19, 2024
6f0936d
cleanup some code
Firebird1029 Mar 19, 2024
feaf72f
remove firebase
Firebird1029 Mar 19, 2024
d101c5c
setup Supabase
Firebird1029 Mar 19, 2024
d2ee15b
Fixed module not found and index page bug
davidcrair Mar 19, 2024
7243e49
Fix radar chart
davidcrair Mar 19, 2024
4b1624b
Fix index page buttons
davidcrair Mar 19, 2024
7f3e69b
Update frontend.t.js.snap
davidcrair Mar 19, 2024
649c655
WIP login with Spotify
Firebird1029 Mar 19, 2024
be17906
Added user data object
davidcrair Mar 19, 2024
2e71fa8
Add user profile to user data
davidcrair Mar 19, 2024
dca530e
removed console log
davidcrair Mar 19, 2024
6de8802
working Supabase auth
Firebird1029 Mar 19, 2024
94eacbf
create user page
Firebird1029 Mar 19, 2024
57730da
Merge pull request #22 from Firebird1029/user_data
Firebird1029 Mar 19, 2024
36227ed
Fixed module not found and index page bug
davidcrair Mar 19, 2024
f0b6d15
Fix radar chart
davidcrair Mar 19, 2024
f4a10fe
Fix index page buttons
davidcrair Mar 19, 2024
854653d
Update frontend.t.js.snap
davidcrair Mar 19, 2024
e8e89c7
Added user data object
davidcrair Mar 19, 2024
133217d
Add user profile to user data
davidcrair Mar 19, 2024
4185b95
removed console log
davidcrair Mar 19, 2024
e4bd28d
Merge pull request #23 from Firebird1029/add-supabase
Firebird1029 Mar 19, 2024
63b871b
Change userData object
davidcrair Mar 19, 2024
cf53959
Update page.jsx
davidcrair Mar 21, 2024
b1960aa
Added unify page
davidcrair Mar 21, 2024
2d17699
Add genre pie chart to user content
davidcrair Mar 21, 2024
7a258a6
Update unify page
davidcrair Mar 21, 2024
ba55782
Added pie charts to unify page
davidcrair Mar 21, 2024
80e42a2
Add sharecassette to new user page
davidcrair Mar 21, 2024
c01d4cd
Fix share cassette svg
davidcrair Mar 21, 2024
c155312
Added placeholder elements to unify page
davidcrair Mar 21, 2024
f80a6cb
Add share unify results
davidcrair Mar 21, 2024
197eebc
Update UnifyContent.jsx
davidcrair Mar 21, 2024
f1acc24
Upadte login to main page
davidcrair Mar 22, 2024
8d87aab
Fix cassette share link
davidcrair Mar 22, 2024
5748034
Merge pull request #24 from Firebird1029/unify_page
Firebird1029 Mar 23, 2024
15deeb9
fix testing script
Firebird1029 Mar 23, 2024
53a03df
fix test script env vars
Firebird1029 Mar 23, 2024
fdcf5e4
add Supabase env vars & undo Jest config
Firebird1029 Mar 23, 2024
0e2ee7b
fix all ESLint errors
Firebird1029 Mar 23, 2024
7d70ed8
update UnifyContent location
Firebird1029 Mar 23, 2024
b23314c
Merge pull request #25 from Firebird1029/cleanup-for-vercel
Firebird1029 Mar 23, 2024
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
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
NEXT_PUBLIC_CLIENT_ID="319f3f19b0794ac28b1df51ca946609c"
NEXT_PUBLIC_REDIRECT_URI="http://localhost:3000"
NEXT_PUBLIC_REDIRECT_URI="http://localhost:3000/auth/callback"
NEXT_PUBLIC_AUTH_ENDPOINT="https://accounts.spotify.com/authorize"
NEXT_PUBLIC_RESPONSE_TYPE="token"
NEXT_PUBLIC_BACKEND_URL="http://localhost:3001"
NEXT_PUBLIC_FRONTENT_URL="localhost:3000"
NEXT_PUBLIC_SUPABASE_URL=https://dkuewaaupmoqazilskoo.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRrdWV3YWF1cG1vcWF6aWxza29vIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTA4MTc1MjIsImV4cCI6MjAyNjM5MzUyMn0.KgPgXhCY0jZxmUh9lOAYNcVBQFBU3vuSnl3Yfid_U6g
30 changes: 28 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
"airbnb",
"plugin:prettier/recommended"
],
"overrides": [],
"overrides": [
{
"files": ["route.js"],
"rules": {
"import/prefer-default-export": "off"
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
Expand All @@ -25,6 +32,25 @@
"no-unused-vars": "warn",
"no-console": "warn",
"import/no-extraneous-dependencies": "off",
"no-plusplus": "off"
"no-plusplus": "off",

// https://stackoverflow.com/a/72643821
"import/extensions": [
"error",
"ignorePackages",
{
"": "never",
"js": "never",
"jsx": "never"
}
],

// https://github.com/firebase/firebase-admin-node/discussions/1359#discussioncomment-977900
"import/no-unresolved": [
"error",
{
"ignore": ["^@/.+"]
}
]
}
}
18 changes: 18 additions & 0 deletions .github/workflows/lint-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint (Dev)
on:
pull_request:
branches:
- dev
jobs:
lint-code:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Install modules
run: npm ci
- name: Run Lint script
run: npm run lint:dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Lint
name: Lint (Prod)
on:
push:
branches-ignore:
pull_request:
branches:
- master
jobs:
lint-code:
Expand All @@ -15,7 +15,4 @@ jobs:
- name: Install modules
run: npm ci
- name: Run Lint script
run: npm run lint
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[Github Actions] lint files"
run: npm run lint:prod
10 changes: 7 additions & 3 deletions .github/workflows/test-v1.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Test
on: pull_request
on:
pull_request:
branches:
- master
- dev
jobs:
test-backend:
test-code:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./server
working-directory: ./

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Custom
.eslintcache
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# README

## Setup
## Installation & Setup

```bash
npm install
touch server/.env
touch api/.env
```

## Development

You should start both the frontend and backend simultaneously, e.g. in two Terminal windows.
To start the frontend and backend locally together, simply run `npm run dev`. Ctrl+C will kill both processes.

### Frontend

To run the frontend application in development:

```bash
npm run dev
npm run next-dev
```

Access it from `localhost:3000`.
Expand All @@ -26,7 +26,7 @@ Access it from `localhost:3000`.
To run the backend server in development:

```bash
npm run server
npm run server-dev
```

Access it from `localhost:3001`.
Expand Down
540 changes: 540 additions & 0 deletions __tests__/__snapshots__/frontend.t.js.snap

Large diffs are not rendered by default.

88 changes: 46 additions & 42 deletions __tests__/backend.t.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const request = require("supertest");
const axios = require("axios");
const app = require("../server/server");
// const axios = require("axios");
const app = require("../api/server");

jest.mock("axios");

Expand All @@ -18,56 +18,60 @@ describe("Express App Tests", () => {
});
});

describe("GET /getUserProfile", () => {
it("should respond with user profile when valid token is provided", async () => {
axios.get.mockResolvedValue({ data: { uri: "some-uri" } });
// TODO @David these two tests below do not actually work lol
// TODO @David if you uncomment and run `npm test` then it returns errors

const response = await request(app).get(
"/getUserProfile?token=valid-token",
);
// describe("GET /getUserProfile", () => {
// it("should respond with user profile when valid token is provided", async () => {
// axios.get.mockResolvedValue({ data: { uri: "some-uri" } });

expect(response.statusCode).toBe(200);
expect(response.body.profile).toBeDefined();
});
// const response = await request(app).get(
// "/getUserProfile?token=valid-token",
// );

it("should respond with 400 when no token is provided", async () => {
const response = await request(app).get("/getUserProfile");
// expect(response.statusCode).toBe(200);
// expect(response.body.profile).toBeDefined();
// });

expect(response.statusCode).toBe(400);
});
// it("should respond with 400 when no token is provided", async () => {
// const response = await request(app).get("/getUserProfile");

it("should respond with 500 when error occurs", async () => {
const response = await request(app).get(
"/getTopItems?token=invalid-token",
);
expect(response.statusCode).toBe(500);
});
});
// expect(response.statusCode).toBe(400);
// });

describe("GET /getTopItems", () => {
it("should respond with top items when valid token and type are provided", async () => {
axios.get.mockResolvedValue({ data: { items: ["item1", "item2"] } });
// it("should respond with 500 when error occurs", async () => {
// const response = await request(app).get(
// "/getTopItems?token=invalid-token",
// );

const response = await request(app).get(
"/getTopItems?token=valid-token&type=artists",
);
// expect(response.statusCode).toBe(500);
// });
// });

expect(response.statusCode).toBe(200);
expect(response.body.topItems).toBeDefined();
});
// describe("GET /getTopItems", () => {
// it("should respond with top items when valid token and type are provided", async () => {
// axios.get.mockResolvedValue({ data: { items: ["item1", "item2"] } });

it("should respond with 400 when no token is provided", async () => {
const response = await request(app).get("/getTopItems?type=artists");
// const response = await request(app).get(
// "/getTopItems?token=valid-token&type=artists",
// );

expect(response.statusCode).toBe(400);
});
// expect(response.statusCode).toBe(200);
// expect(response.body.topItems).toBeDefined();
// });

it("should respond with 500 when error occurs", async () => {
const response = await request(app).get(
"/getTopItems?token=invalid-token&type=artists",
);
// it("should respond with 400 when no token is provided", async () => {
// const response = await request(app).get("/getTopItems?type=artists");

expect(response.statusCode).toBe(500);
});
});
// expect(response.statusCode).toBe(400);
// });

// it("should respond with 500 when error occurs", async () => {
// const response = await request(app).get(
// "/getTopItems?token=invalid-token&type=artists",
// );

// expect(response.statusCode).toBe(500);
// });
// });
});
16 changes: 9 additions & 7 deletions __tests__/frontend.t.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/* eslint-disable react/jsx-filename-extension */

// Import necessary utilities from React Testing Library
import React from 'react';
import { render } from '@testing-library/react';
import React from "react";
import { render } from "@testing-library/react";

// Import the component to be tested
import Index from '../src/components/Index'; // Adjust the import path to your actual file location
import HomePage from "../src/app/Index"; // Adjust the import path to your actual file location

// Jest snapshot test
describe('Index Component', () => {
it('matches the snapshot', () => {
const { asFragment } = render(<Index />);
describe("Index Component", () => {
it("matches the snapshot", () => {
const { asFragment } = render(<HomePage />);
expect(asFragment()).toMatchSnapshot();
});
});
});
19 changes: 0 additions & 19 deletions __tests__/routes.t.js

This file was deleted.

File renamed without changes.
12 changes: 12 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const app = require("./server");

app.listen(process.env.PORT || 3001, () => {
console.log(`App listening on port ${process.env.PORT || 3001}.`); // eslint-disable-line no-console
});

/*
* TODO
* migrate all server.js to spotify.js
* delete api folder
* update README, package.json, Github Action scripts to reflect changes
*/
Loading