fmt
This commit is contained in:
parent
0c1de423ef
commit
42ca60c026
|
@ -2,17 +2,17 @@ module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
env: { browser: true, es2020: true },
|
env: { browser: true, es2020: true },
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
"eslint:recommended",
|
||||||
'plugin:@typescript-eslint/recommended',
|
"plugin:@typescript-eslint/recommended",
|
||||||
'plugin:react-hooks/recommended',
|
"plugin:react-hooks/recommended",
|
||||||
],
|
],
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: "@typescript-eslint/parser",
|
||||||
plugins: ['react-refresh'],
|
plugins: ["react-refresh"],
|
||||||
rules: {
|
rules: {
|
||||||
'react-refresh/only-export-components': [
|
"react-refresh/only-export-components": [
|
||||||
'warn',
|
"warn",
|
||||||
{ allowConstantExport: true },
|
{ allowConstantExport: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
|
@ -6,4 +6,4 @@ COPY . /temp/prod/
|
||||||
RUN cd /temp/prod && bun run build
|
RUN cd /temp/prod && bun run build
|
||||||
|
|
||||||
FROM nginx AS release
|
FROM nginx AS release
|
||||||
COPY --from=install /temp/prod/dist /usr/share/nginx/html
|
COPY --from=install /temp/prod/dist /usr/share/nginx/html
|
||||||
|
|
15
index.html
15
index.html
|
@ -1,13 +1,20 @@
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
rel="icon"
|
||||||
|
type="image/svg+xml"
|
||||||
|
href="/vite.svg" />
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + React + TS</title>
|
<title>Vite + React + TS</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script
|
||||||
|
type="module"
|
||||||
|
src="/src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
db = new Mongo().getDB("bot");
|
db = new Mongo().getDB("bot");
|
||||||
|
|
||||||
db.createCollection('authorizations');
|
db.createCollection("authorizations");
|
||||||
|
|
||||||
db.authorizations.insert([
|
db.authorizations.insert([
|
||||||
{
|
{
|
||||||
app: "tester",
|
app: "tester",
|
||||||
secret: "test"
|
secret: "test",
|
||||||
}
|
},
|
||||||
])
|
]);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export interface ButtonProps {
|
export interface ButtonProps {
|
||||||
label: string;
|
label: string;
|
||||||
action?: () => void;
|
action?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ImageViewer(props: ButtonProps) {
|
export default function ImageViewer(props: ButtonProps) {
|
||||||
return <button onClick={props.action}>{props.label}</button>
|
return <button onClick={props.action}>{props.label}</button>;
|
||||||
}
|
}
|
||||||
|
|
10
src/main.tsx
10
src/main.tsx
|
@ -1,7 +1,5 @@
|
||||||
import ReactDOM from 'react-dom/client'
|
import ReactDOM from "react-dom/client";
|
||||||
import App from './App.tsx'
|
import App from "./App.tsx";
|
||||||
import './index.css'
|
import "./index.css";
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
|
||||||
<App />
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,29 +1,31 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { render, screen } from "@testing-library/react";
|
import { render, screen } from "@testing-library/react";
|
||||||
import { describe, expect, it } from "bun:test";
|
import { describe, expect, it } from "bun:test";
|
||||||
import ImageModerator, { ImageModeratorProps } from '../../src/components/ImageModerator/ImageModerator';
|
import ImageModerator, {
|
||||||
|
ImageModeratorProps,
|
||||||
|
} from "../../src/components/ImageModerator/ImageModerator";
|
||||||
|
|
||||||
const properties: ImageModeratorProps = {
|
const properties: ImageModeratorProps = {
|
||||||
acceptLabel: "Accept",
|
acceptLabel: "Accept",
|
||||||
discardLabel: "Discard"
|
discardLabel: "Discard",
|
||||||
}
|
};
|
||||||
|
|
||||||
it("should render into the document", () => {
|
it("should render into the document", () => {
|
||||||
render(<ImageModerator {...properties} />);
|
render(<ImageModerator {...properties} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show a new image when accept button is clicked", () => {
|
it("should show a new image when accept button is clicked", () => {
|
||||||
const acceptButton = screen.getByText(properties.acceptLabel);
|
const acceptButton = screen.getByText(properties.acceptLabel);
|
||||||
const imgElement = screen.getByRole("img");
|
const imgElement = screen.getByRole("img");
|
||||||
const imgElementSrcBefore = imgElement.getAttribute("src");
|
const imgElementSrcBefore = imgElement.getAttribute("src");
|
||||||
acceptButton.click();
|
acceptButton.click();
|
||||||
expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore);
|
expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show a new image when discard button is clicked", () => {
|
it("should show a new image when discard button is clicked", () => {
|
||||||
const discardButton = screen.getByText(properties.discardLabel);
|
const discardButton = screen.getByText(properties.discardLabel);
|
||||||
const imgElement = screen.getByRole("img");
|
const imgElement = screen.getByRole("img");
|
||||||
const imgElementSrcBefore = imgElement.getAttribute("src");
|
const imgElementSrcBefore = imgElement.getAttribute("src");
|
||||||
discardButton.click();
|
discardButton.click();
|
||||||
expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore);
|
expect(imgElement.getAttribute("src")).not.toEqual(imgElementSrcBefore);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from "vite";
|
||||||
import react from '@vitejs/plugin-react-swc'
|
import react from "@vitejs/plugin-react-swc";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()]
|
plugins: [react()],
|
||||||
})
|
});
|
||||||
|
|
Loading…
Reference in New Issue