-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
15,285 additions
and
4,435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ["@babel/preset-env", "@babel/preset-react"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
testEnvironment: "jsdom", | ||
moduleFileExtensions: ["js", "jsx", "json", "node"], | ||
moduleNameMapper: { | ||
"\\.(css|less|scss|sass)$": "identity-obj-proxy", | ||
"\\.(svg)$": "<rootDir>/path/to/svg-transformer.js", | ||
}, | ||
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/build/"], | ||
collectCoverageFrom: [ | ||
"src/**/*.{js,jsx}", | ||
"!<rootDir>/node_modules/", | ||
"!<rootDir>/build/", | ||
], | ||
coverageReporters: ["html", "text-summary"], | ||
verbose: true, | ||
transform: { | ||
"^.+\\.(js|jsx)$": "babel-jest", | ||
}, | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import { useAuthContext } from "../context/authContext"; | ||
|
||
import Login from "../components/login/Login"; | ||
|
||
jest.mock("../context/authContext", () => ({ | ||
useAuthContext: jest.fn(), | ||
})); | ||
|
||
describe("Login component", () => { | ||
test("renders without error", () => { | ||
useAuthContext.mockReturnValue({ userToken: null }); | ||
render(<Login />); | ||
}); | ||
|
||
test("displays login form", () => { | ||
useAuthContext.mockReturnValue({ userToken: null }); | ||
const { getByRole } = render(<Login />); | ||
const form = getByRole("form"); | ||
expect(form).toBeInTheDocument(); | ||
}); | ||
|
||
test("displays logged in message if user is already logged in", () => { | ||
useAuthContext.mockReturnValue({ userToken: "some_token" }); | ||
const { getByText } = render(<Login />); | ||
const message = getByText("You are already logged in."); | ||
expect(message).toBeInTheDocument(); | ||
}); | ||
|
||
test("displays dashboard link if user is already logged in", () => { | ||
useAuthContext.mockReturnValue({ userToken: "some_token" }); | ||
const { getByRole } = render(<Login />); | ||
const link = getByRole("link", { name: "Go to dashboard" }); | ||
expect(link).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.shipyard-container { | ||
width: 100%; | ||
} | ||
|
||
.shipyard { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.5rem; | ||
color: var(--white); | ||
} | ||
|
||
.shipyard-capacity-container { | ||
display: flex; | ||
gap: 1rem; | ||
} | ||
|
||
.shipyard-card { | ||
display: flex; | ||
flex-direction: column; | ||
border: 2px solid var(--gray); | ||
border-radius: 0.75rem; | ||
padding: 1rem; | ||
gap: 0.5rem; | ||
} | ||
|
||
.shipyard-name { | ||
font-weight: var(--font-weight-semibold); | ||
} | ||
|
||
.shipyard-capacity, | ||
.shipyard-price { | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
gap: 0.25rem; | ||
} | ||
|
||
.shipyard-price { | ||
gap: 0.5rem; | ||
} | ||
|
||
.shipyard-price__button { | ||
background: linear-gradient(94deg, var(--cream) -1.06%, var(--lavender) 100%); | ||
border: none; | ||
font-size: 1rem; | ||
cursor: pointer; | ||
color: var(--black); | ||
font-weight: var(--font-weight-semibold); | ||
padding: 0.5rem 1rem; | ||
border-radius: 0.75rem; | ||
} | ||
|
||
.shipyard-price__button:disabled { | ||
cursor: not-allowed; | ||
opacity: 0.5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.