Skip to content
Open
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
78 changes: 39 additions & 39 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@
// https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-postgres/.devcontainer/devcontainer.json

{
"name": "Node.js & PostgreSQL",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "node",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "none"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},
"name": "Node.js & PostgreSQL",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "node",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "none"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-vsliveshare.vsliveshare"
]
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-vsliveshare.vsliveshare"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or with the host.
"forwardPorts": [3000, 3001, 5432, 5555],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or with the host.
"forwardPorts": [3000, 3001, 5432, 5555],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",

"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"postAttachCommand": "./codespace-instructions.sh"
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"postAttachCommand": "./codespace-instructions.sh"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you have used GitHub Codespaces in other projects, doing the same in freeCode

Within freeCodeCamp Classroom, GitHub Codespaces is on par with Gitpod so that you can use either.

This [video](https://www.loom.com/share/37dcb9555ad642618d82619277daaa38?sid=c17189b2-5798-44c9-8b74-38749f3578e1) walks through the setup process on Github Codespaces. Note that this video was recorded on Feb 10, 2025. It is not guaranteed to be up to date with any new setup instructions added after that date.
This [video](https://www.loom.com/share/37dcb9555ad642618d82619277daaa38?sid=c17189b2-5798-44c9-8b74-38749f3578e1) walks through the setup process on Github Codespaces. Note that this video was recorded on Feb 10, 2025. It is not guaranteed to be up to date with any new setup instructions added after that date.

### Optional - GitPod Dev Environment

Expand Down
78 changes: 38 additions & 40 deletions __tests__/components/adminTable.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,48 @@ import AdminTable from '../../components/adminTable';
import React from 'react';
import renderer from 'react-test-renderer';
const sampleColumns = [
{
name: 'Name',
selector: row => row.name
},
{
name: 'Email',
selector: row => row.userEmail
},
{
name: 'Role',
selector: row => row.role
},
{
name: 'Actions',
selector: row => row.adminActions
}
];
const sampleUsers=[
{
id: 1,
name: "Hamzat Victor",
email: "oluwaborihamzat@gmail.com",
role: "ADMIN"
},
{
id: 2,
name: "Alade Christopher",
email: "aladechristoph@gmail.com",
role: "TEACHER"
},
{
id: 3,
name: "Ayomide onifade",
email: "Jangulabi@gmail.com",
role: "TEACHER"
},
]
{
name: 'Name',
selector: row => row.name
},
{
name: 'Email',
selector: row => row.userEmail
},
{
name: 'Role',
selector: row => row.role
},
{
name: 'Actions',
selector: row => row.adminActions
}
];
const sampleUsers = [
{
id: 1,
name: 'Hamzat Victor',
email: 'oluwaborihamzat@gmail.com',
role: 'ADMIN'
},
{
id: 2,
name: 'Alade Christopher',
email: 'aladechristoph@gmail.com',
role: 'TEACHER'
},
{
id: 3,
name: 'Ayomide onifade',
email: 'Jangulabi@gmail.com',
role: 'TEACHER'
}
];

describe('AdminTable', () => {
it('displays 3 rows of data with expected column names: name, email, role, action', () => {
const tree = renderer
.create(
<AdminTable data={sampleUsers} columns={sampleColumns}/>
)
.create(<AdminTable data={sampleUsers} columns={sampleColumns} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/dashtable_v2.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ describe('GlobalDashboardTable', () => {
expect(getTimeSpy).toHaveBeenCalled();
expect(container).toMatchSnapshot();
});
});
});
1 change: 0 additions & 1 deletion __tests__/components/layout.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Layout from '../../components/layout';
import React from 'react';
import renderer from 'react-test-renderer';


describe('Layout', () => {
it('displays expected children', () => {
const tree = renderer
Expand Down
22 changes: 12 additions & 10 deletions __tests__/components/modal.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Modal from '../../components/modal';
import React from 'react';
import renderer, {act} from 'react-test-renderer';
import renderer, { act } from 'react-test-renderer';

const sampleData = [
{
Expand Down Expand Up @@ -30,25 +30,27 @@ const sampleData = [
}
];

const sampleUser = "Ayomide";
const className = 'flex cursor-pointer justify-center p-4 m-6 rounded-md hover:bg-fcc-primary-yellow shadedow-lg border-solid border-color: inherit; border-2 pl-4 pr-4 bg-[#feac32] text-black'
const sampleUser = 'Ayomide';
const className =
'flex cursor-pointer justify-center p-4 m-6 rounded-md hover:bg-fcc-primary-yellow shadedow-lg border-solid border-color: inherit; border-2 pl-4 pr-4 bg-[#feac32] text-black';

describe('Modal Component', () => {
it('renders header correctly', () => {
const tree = renderer.create(<Modal userId= {sampleUser} certificationNames= {sampleData} />).toJSON();
const tree = renderer
.create(<Modal userId={sampleUser} certificationNames={sampleData} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders whole form after header clicked', ()=> {
const testRenderer = renderer.create(<Modal userId= {sampleUser} certificationNames= {sampleData} />);
it('renders whole form after header clicked', () => {
const testRenderer = renderer.create(
<Modal userId={sampleUser} certificationNames={sampleData} />
);
const testInstance = testRenderer.root;
const header = testInstance.findByProps({className})
const header = testInstance.findByProps({ className });
act(() => {
header.props.onClick();
});
const tree = testRenderer.toJSON();
expect(tree).toMatchSnapshot();
});
});



49 changes: 23 additions & 26 deletions __tests__/components/updateUserForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,44 @@ import UpdateUserForm from '../../components/updateUserForm';
import React from 'react';
import renderer from 'react-test-renderer';

const sampleUsers=[
{
id: '5f33071498eb2472b87ddee4',
name: "Hamzat Victor",
email: "oluwaborihamzat@gmail.com",
role: "ADMIN"
},
{
id: '72245f33071498ebb87ccee4',
name: "Alade Christopher",
email: "aladechristoph@gmail.com",
role: "TEACHER"
},
{
id: '98eb72245f330714b87ccee4',
name: "Ayomide onifade",
email: "Jangulabi@gmail.com",
role: "NONE"
},
]

const sampleUsers = [
{
id: '5f33071498eb2472b87ddee4',
name: 'Hamzat Victor',
email: 'oluwaborihamzat@gmail.com',
role: 'ADMIN'
},
{
id: '72245f33071498ebb87ccee4',
name: 'Alade Christopher',
email: 'aladechristoph@gmail.com',
role: 'TEACHER'
},
{
id: '98eb72245f330714b87ccee4',
name: 'Ayomide onifade',
email: 'Jangulabi@gmail.com',
role: 'NONE'
}
];

describe('updateUserForm', () => {

it('shows a form for user to update details', () => {
const tree = renderer
.create(<UpdateUserForm userInfo={sampleUsers[2]} />)
.create(<UpdateUserForm userInfo={sampleUsers[2]} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it(`doesn't show other roles if user role is "ADMIN"`, () => {
const tree = renderer
.create(<UpdateUserForm userInfo={sampleUsers[0]} />)
.create(<UpdateUserForm userInfo={sampleUsers[0]} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it(`shows all available roles if user role is not "ADMIN"`, () => {
const tree = renderer
.create(<UpdateUserForm userInfo={sampleUsers[1]} />)
.create(<UpdateUserForm userInfo={sampleUsers[1]} />)
.toJSON();
expect(tree).toMatchSnapshot();
});

});
5 changes: 2 additions & 3 deletions components/ClassInviteTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ export default function ClassInviteTable({
);

const ref = useRef();
const userCurrentDomain = process.env.NEXTAUTH_URL;
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000';

const copy = async () => {
//Add the full URL to send to student
await navigator.clipboard.writeText(
`${userCurrentDomain}/join/` + currentClass.classroomId
`${baseUrl}/join/${currentClass.classroomId}`
);

toast('Class code successfully copied', {
Expand Down
Loading