{
+test('renders a code block highlighted in a notification', async () => {
const body = await render([notification]);
assert.match(body, /]*>return<\/span>/);
@@ -91,7 +91,7 @@ void test('renders a code block highlighted in a notification', async () => {
});
for (const isFollowing of [false, true]) {
- void test(`keeps ${isFollowing ? 'unfollow' : 'follow-back'} separate from highlighted notification links`, async () => {
+ test(`keeps ${isFollowing ? 'unfollow' : 'follow-back'} separate from highlighted notification links`, async () => {
const followed = {
...notification,
id: 'follow-notification',
diff --git a/tests/Unit/QuotedCommit.test.tsx b/tests/Unit/QuotedCommit.test.tsx
index 4170965951..83b20fc62c 100644
--- a/tests/Unit/QuotedCommit.test.tsx
+++ b/tests/Unit/QuotedCommit.test.tsx
@@ -1,7 +1,7 @@
///
import assert from 'node:assert/strict';
-import { test } from 'node:test';
+import { test } from 'vite-plus/test';
import { createInertiaApp } from '@inertiajs/react';
import { renderToString } from 'react-dom/server';
import { QuotedCommit } from '../../resources/js/components/quoted-commit';
@@ -46,7 +46,16 @@ async function render(
const result = await createInertiaApp({
page: {
component: 'quote',
- props: { errors: {} },
+ props: {
+ errors: {},
+ auth: {
+ user: null,
+ isAdmin: false,
+ log: null,
+ unreadNotificationsCount: 0,
+ pasteis: null,
+ },
+ },
url: '/@author/quote',
version: null,
clearHistory: false,
@@ -68,7 +77,7 @@ async function render(
}
for (const isPreview of [false, true]) {
- void test(`renders a quoted code block highlighted ${isPreview ? 'in the composer' : 'in the log'}`, async () => {
+ test(`renders a quoted code block highlighted ${isPreview ? 'in the composer' : 'in the log'}`, async () => {
const body = await render(isPreview);
assert.match(body, /]*>return<\/span>/);
@@ -76,14 +85,14 @@ for (const isPreview of [false, true]) {
});
}
-void test('keeps the quote a single link', async () => {
+test('keeps the quote a single link', async () => {
const body = await render(false);
assert.equal(body.match(/ {
+test('shows the options of a quoted poll without letting anyone vote inside the quote', async () => {
const body = await render(false, { ...commit, poll });
assert.match(body, /data-test="commit-poll"/);
@@ -93,7 +102,7 @@ void test('shows the options of a quoted poll without letting anyone vote inside
assert.doesNotMatch(body, /<(input|button|fieldset|label)\b/);
});
-void test('shows the results of a quoted poll once the viewer may see them', async () => {
+test('shows the results of a quoted poll once the viewer may see them', async () => {
const body = await render(true, {
...commit,
poll: {
diff --git a/tests/Unit/SecretWarning.test.tsx b/tests/Unit/SecretWarning.test.tsx
index b52901ae0d..a375ae5f37 100644
--- a/tests/Unit/SecretWarning.test.tsx
+++ b/tests/Unit/SecretWarning.test.tsx
@@ -1,7 +1,7 @@
///
import assert from 'node:assert/strict';
-import { test } from 'node:test';
+import { test } from 'vite-plus/test';
import { createElement, useState } from 'react';
import { renderToString } from 'react-dom/server';
import { useSecretWarning } from '../../resources/js/hooks/use-secret-warning';
@@ -31,7 +31,7 @@ function run(steps: Step[]): void {
renderToString(createElement(Scenario));
}
-void test('allows ordinary text without asking for confirmation', () => {
+test('allows ordinary text without asking for confirmation', () => {
run([
{
body: 'Shipped a quote with https://example.com/release',
@@ -43,7 +43,7 @@ void test('allows ordinary text without asking for confirmation', () => {
]);
});
-void test('requires confirmation and consumes approval for a single submission', () => {
+test('requires confirmation and consumes approval for a single submission', () => {
run([
{
body: token,
@@ -70,7 +70,7 @@ void test('requires confirmation and consumes approval for a single submission',
]);
});
-void test('keeping editing does not approve the detected secret', () => {
+test('keeping editing does not approve the detected secret', () => {
run([
{
body: token,
diff --git a/tests/Unit/SensitiveText.test.ts b/tests/Unit/SensitiveText.test.ts
index 3e30a2c460..42fff10aa1 100644
--- a/tests/Unit/SensitiveText.test.ts
+++ b/tests/Unit/SensitiveText.test.ts
@@ -1,5 +1,5 @@
import assert from 'node:assert/strict';
-import { test } from 'node:test';
+import { test } from 'vite-plus/test';
import {
findSecrets,
removeSecrets,
@@ -8,7 +8,7 @@ import {
const githubToken = 'ghp_' + 'Ab3dEf6hIj9kLm2nOp5qRs8tUv1wXy4zABCD';
-await test('finds a pasted token and returns the exact selection after Unicode text', () => {
+test('finds a pasted token and returns the exact selection after Unicode text', () => {
const body = `My key 🔑: ${githubToken}`;
const findings = findSecrets(body);
assert.equal(findings.length, 1);
@@ -16,7 +16,7 @@ await test('finds a pasted token and returns the exact selection after Unicode t
assert.equal(stashableBody(body), '');
});
-await test('removes multiple secrets without changing surrounding prose', () => {
+test('removes multiple secrets without changing surrounding prose', () => {
const body = `Token ${githubToken}; database postgres://demo:LocalOnly7z9@localhost/demo`;
const cleaned = removeSecrets(body);
assert.equal(cleaned, 'Token [REDACTED]; database [REDACTED]');
@@ -24,14 +24,14 @@ await test('removes multiple secrets without changing surrounding prose', () =>
assert.equal(stashableBody(cleaned), cleaned);
});
-await test('detects a complete private key block', () => {
+test('detects a complete private key block', () => {
const body =
'-----BEGIN PRIVATE KEY-----\nAbCdEfGhIjKlMnOp1234567890\n-----END PRIVATE KEY-----';
assert.ok(findSecrets(body).length > 0);
assert.equal(stashableBody(body), '');
});
-await test('preserves ordinary code and obvious placeholder examples', () => {
+test('preserves ordinary code and obvious placeholder examples', () => {
for (const body of [
'',
'const id = "a1b2c3d4"; // hello world',
diff --git a/tests/Unit/SeriesStash.test.ts b/tests/Unit/SeriesStash.test.ts
deleted file mode 100644
index c2f12ddc9e..0000000000
--- a/tests/Unit/SeriesStash.test.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { execFileSync } from 'node:child_process';
-import { test } from 'node:test';
-import { fileURLToPath } from 'node:url';
-
-await test('draft images survive editing, restoration, and sensitive text confirmation', () => {
- const cli = fileURLToPath(
- new URL('./bin/vp', import.meta.resolve('vite-plus/package.json')),
- );
-
- execFileSync(
- process.execPath,
- [cli, 'test', 'run', '--config', 'tests/draft-images.config.ts'],
- {
- cwd: fileURLToPath(new URL('../..', import.meta.url)),
- stdio: 'inherit',
- },
- );
-});
diff --git a/tests/tsconfig.json b/tests/tsconfig.json
index 17221dd096..2f408354e9 100644
--- a/tests/tsconfig.json
+++ b/tests/tsconfig.json
@@ -5,8 +5,9 @@
"allowImportingTsExtensions": true
},
"include": [
+ "../resources/js/**/*.d.ts",
"Unit/**/*.test.ts",
- "Unit/DraftStash.test.tsx",
- "draft-images.config.ts"
+ "Unit/**/*.test.tsx",
+ "unit.config.ts"
]
}
diff --git a/tests/draft-images.config.ts b/tests/unit.config.ts
similarity index 60%
rename from tests/draft-images.config.ts
rename to tests/unit.config.ts
index d5c69926e9..9fbba8a430 100644
--- a/tests/draft-images.config.ts
+++ b/tests/unit.config.ts
@@ -8,10 +8,6 @@ export default defineConfig({
},
},
test: {
- include: [
- 'tests/Unit/DraftStash.test.tsx',
- 'tests/Unit/ComposerDraft.test.tsx',
- 'tests/Unit/QuoteDraft.test.tsx',
- ],
+ include: ['tests/Unit/**/*.test.{ts,tsx}'],
},
});