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