Compare commits

...

2 commits

Author SHA1 Message Date
glazk0
f8f460fe74
misc: did somes changes 2024-10-16 11:26:21 +02:00
glazk0
027628290f
fix: removed tests 2024-10-16 11:26:12 +02:00
12 changed files with 440 additions and 981 deletions

View file

@ -6,7 +6,6 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
@ -24,14 +23,13 @@
"mode-watcher": "^0.3.1",
"svelte-boring-avatars": "^1.2.6",
"svelte-sonner": "^0.3.28",
"tailwind-merge": "^2.5.2",
"tailwind-merge": "^2.5.4",
"tailwind-variants": "^0.2.1",
"vaul-svelte": "^0.3.2"
},
"devDependencies": {
"@playwright/test": "^1.47.1",
"@sveltejs/adapter-node": "^5.2.3",
"@sveltejs/kit": "^2.5.28",
"@sveltejs/adapter-node": "^5.2.7",
"@sveltejs/kit": "^2.7.1",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@tailwindcss/typography": "^0.5.15",
"@typescript-eslint/eslint-plugin": "^7.18.0",
@ -40,19 +38,18 @@
"boring-avatars": "^1.11.2",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.44.0",
"eslint-plugin-svelte": "^2.44.1",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-svelte": "^3.2.7",
"prettier-plugin-tailwindcss": "^0.5.14",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"sveltekit-superforms": "^2.18.1",
"tailwindcss": "^3.4.12",
"tslib": "^2.7.0",
"typescript": "^5.6.2",
"vite": "^5.4.6",
"vitest": "^1.6.0",
"sveltekit-superforms": "^2.19.1",
"tailwindcss": "^3.4.14",
"tslib": "^2.8.0",
"typescript": "^5.6.3",
"vite": "^5.4.9",
"zod": "^3.23.8"
}
}

1304
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ export const handle: Handle = async ({ event, resolve }) => {
}
try {
const user: User = await res.json();
const user = await res.json() as User;
event.locals.user = user;
} catch (error) {
event.locals.user = undefined;

View file

@ -1,7 +0,0 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});

View file

View file

@ -1,17 +0,0 @@
import { browser } from '$app/environment';
import { writable } from 'svelte/store';
const defaultValue = true;
const initialValue = browser
? window.localStorage.getItem('plausible_ignore') === 'true'
: defaultValue;
const plausible = writable<boolean>(initialValue);
plausible.subscribe((value) => {
if (browser) {
window.localStorage.setItem('plausible_ignore', value ? 'true' : 'false');
}
});
export default plausible;

View file

@ -54,6 +54,7 @@
<Form.Control let:attrs>
<Form.Label>Prénom</Form.Label>
<Input {...attrs} bind:value={$formData.firstname} placeholder="Philip" />
<Form.Description>Votre prénom de famille ne sera pas visible par les autres utilisateurs.</Form.Description>
</Form.Control>
<Form.FieldErrors />
</Form.Field>
@ -61,6 +62,7 @@
<Form.Control let:attrs>
<Form.Label>Nom de famille</Form.Label>
<Input {...attrs} bind:value={$formData.lastname} placeholder="Barlow" />
<Form.Description>Votre nom de famille ne sera pas visible par les autres utilisateurs.</Form.Description>
</Form.Control>
<Form.FieldErrors />
</Form.Field>
@ -69,7 +71,7 @@
<Form.Label>Nom d'utilisateur</Form.Label>
<Input {...attrs} bind:value={$formData.pseudo} placeholder="Cypherwolf" />
</Form.Control>
<Form.Description>Ce nom sera visible par les autres utilisateurs.</Form.Description>
<Form.Description>Votre nom d'utilisateur sera visible par les autres utilisateurs.</Form.Description>
<Form.FieldErrors />
</Form.Field>
</form>

View file

@ -21,7 +21,6 @@ export const load: PageServerLoad = async ({ locals: { user } }) => {
export const actions: Actions = {
default: async ({ request, cookies, fetch, url: { searchParams } }) => {
const form = await superValidate(request, zod(loginSchema));
if (!form.valid) {

View file

@ -25,7 +25,6 @@ export const load: PageServerLoad = async ({ locals: { user } }) => {
export const actions: Actions = {
register: async ({ request }) => {
const form = await superValidate(request, zod(registerSchema));
if (!form.valid) {

View file

@ -9,7 +9,7 @@
import { superForm } from 'sveltekit-superforms/client';
import * as Form from '$lib/components/ui/form';
import Input from '$lib/components/ui/input/input.svelte';
import { Input } from '$lib/components/ui/input';
import { registerConfirmationSchema, registerSchema } from '$lib/validations/auth';
@ -155,7 +155,7 @@
<Input
{...attrs}
bind:value={$registerConfirmationFormData.code}
placeholder="0000"
placeholder="0a0a-a0a0"
/>
</Form.Control>
<Form.FieldErrors />
@ -220,9 +220,9 @@
{/if}
<ul class="flex justify-between">
<li>
<a class="text-muted-foreground hover:text-primary" href="/login{$page.url.search}"
>Se connecter</a
>
<a class="text-muted-foreground hover:text-primary" href="/login{$page.url.search}">
Se connecter
</a>
</li>
</ul>
</div>

View file

@ -2,7 +2,6 @@
import '../app.css';
import { Metadata } from '$lib/components';
</script>
<Metadata />

View file

@ -1,51 +0,0 @@
import { expect, test } from '@playwright/test';
test('index page redirects to login page', async ({ page }) => {
await page.goto('/');
await page.waitForURL('/login');
await expect(page.url()).toContain('/login');
});
test('login page has a register link that redirects to the register page', async ({ page }) => {
await page.goto('/login');
const link = await page.$('a[href*="/register"]');
await link?.click();
await page.waitForURL('/register');
await expect(page.url()).toContain('/register');
});
test('register page has a login link that redirects to the login page', async ({ page }) => {
await page.goto('/register');
const link = await page.$('a[href*="/login"]');
await link?.click();
await page.waitForURL('/login');
await expect(page.url()).toContain('/login');
});
test('dashboard page redirects to login page if user is not logged in', async ({ page }) => {
await page.goto('');
await expect(page.url()).toContain('/login');
});
test('login form accepts valid credentials', async ({ page }) => {
await page.context().clearCookies();
await page.goto('/login');
await page.fill('input[name="pseudo"]', 'glazk0');
await page.fill('input[name="passwd"]', 'Cookies Are #Miam42');
await Promise.all([page.getByRole('button').click(), page.waitForURL('')]);
await expect(page.url()).toContain('');
});