-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from gbedardsiceupgrade/vite
Update dependencies and move to vite
- Loading branch information
Showing
15 changed files
with
2,298 additions
and
6,652 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
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,6 @@ | ||
module.exports = { | ||
presets: [ | ||
"@babel/preset-env", | ||
["@babel/preset-react", { runtime: "automatic" }], | ||
], | ||
}; |
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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, shrink-to-fit=no" | ||
/> | ||
<meta name="theme-color" content="#000000" /> | ||
<link rel="shortcut icon" href="/favicon.ico" /> | ||
<title>Upgrade challenge</title> | ||
</head> | ||
<body> | ||
<noscript> You need to enable JavaScript to run this app. </noscript> | ||
<div id="root"></div> | ||
<script type="module" src="/src/index.jsx"></script> | ||
</body> | ||
</html> |
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
Binary file not shown.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const request = require("supertest"); | ||
const app = require("."); | ||
|
||
const error = (err) => { | ||
if (err) throw err; | ||
}; | ||
|
||
it("returns colors", async () => { | ||
const response = await request(app).get("/api/colors"); | ||
|
||
expect(response.headers["content-type"]).toEqual( | ||
expect.stringContaining("json") | ||
); | ||
expect(response.statusCode).toBe(200); | ||
expect(response.body).toEqual(["black", "blue", "green", "red", "white"]); | ||
}); | ||
|
||
it("returns 404 when trying to GET the submit endpoint", async () => { | ||
const response = await request(app).get("/api/submit"); | ||
|
||
expect(response.statusCode).toBe(404); | ||
}); | ||
|
||
it("submits the user information", async () => { | ||
const response = await request(app).post("/api/submit").send({ | ||
name: "Foo", | ||
password: "foo", | ||
email: "[email protected]", | ||
color: "blue", | ||
terms: true, | ||
}); | ||
|
||
expect(response.statusCode).toBe(200); | ||
}); | ||
|
||
it("returns 400 when submitting Error as the name", async () => { | ||
const response = await request(app).post("/api/submit").send({ | ||
name: "Error", | ||
password: "foo", | ||
email: "[email protected]", | ||
color: "blue", | ||
terms: true, | ||
}); | ||
|
||
expect(response.statusCode).toBe(400); | ||
}); | ||
|
||
it("returns 400 when submitting with missing fields", async () => { | ||
const response = await request(app).post("/api/submit").send({ | ||
name: "Error", | ||
email: "[email protected]", | ||
color: "blue", | ||
terms: true, | ||
}); | ||
|
||
expect(response.statusCode).toBe(400); | ||
}); | ||
|
||
it("returns 400 when submitting with an empty field", async () => { | ||
const response = await request(app).post("/api/submit").send({ | ||
name: "", | ||
email: "[email protected]", | ||
color: "blue", | ||
terms: true, | ||
}); | ||
|
||
expect(response.statusCode).toBe(400); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { Component } from "react"; | ||
|
||
const App = () => { | ||
return ( | ||
<div> | ||
<header> | ||
<h1>Welcome to Upgrade challenge</h1> | ||
</header> | ||
<p> | ||
To get started, edit <code>src/App.jsx</code> and save to reload. | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { createRoot } from "react-dom/client"; | ||
import App from "./App"; | ||
|
||
it("renders without crashing", () => { | ||
const div = document.createElement("div"); | ||
const root = createRoot(div); | ||
|
||
root.render(<App />); | ||
root.unmount(div); | ||
}); |
File renamed without changes.
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,11 @@ | ||
import { defineConfig } from "vite"; | ||
import react from "@vitejs/plugin-react"; | ||
|
||
export default defineConfig(() => { | ||
return { | ||
build: { | ||
outDir: "build", | ||
}, | ||
plugins: [react()], | ||
}; | ||
}); |
Oops, something went wrong.