Skip to content

Commit eb3706c

Browse files
committed
chore: remove unnecessary example tests
1 parent 9079393 commit eb3706c

File tree

6 files changed

+2
-234
lines changed

6 files changed

+2
-234
lines changed

Diff for: test/e2e/example.test.js

+1-75
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,7 @@
1-
// Modules, constants, and variables
2-
// -----------------------------------------------------------------------------
31
import docsifyInit from '../helpers/docsify-init.js';
42
import { test, expect } from './fixtures/docsify-init-fixture.js';
53

6-
// Suite
7-
// -----------------------------------------------------------------------------
8-
test.describe('Example Tests', () => {
9-
// Tests
10-
// ---------------------------------------------------------------------------
11-
test('dom manipulation', async ({ page }) => {
12-
const testText = 'This is a test';
13-
const testHTML = `<h1>Test</h1><p>${testText}</p>`;
14-
15-
// Inject HTML
16-
await page.setContent(testHTML);
17-
18-
// Get reference to page element
19-
const bodyElm = page.locator('body');
20-
const pElm = page.locator('body > p');
21-
22-
// Add class to element and test
23-
await bodyElm.evaluate(elm => elm.classList.add('foo'));
24-
25-
// Tests
26-
await expect(bodyElm).toHaveClass('foo');
27-
await expect(bodyElm).toContainText('Test');
28-
await expect(pElm).toHaveCount(1);
29-
await expect(pElm).toHaveText(testText);
30-
await expect(pElm).not.toHaveText('NOPE');
31-
});
32-
33-
test('javascript in browser context', async ({ page }) => {
34-
// Get native DOM values
35-
const clientDimensions = await page.evaluate(() => {
36-
return {
37-
width: document.documentElement.clientWidth,
38-
height: document.documentElement.clientHeight,
39-
};
40-
});
41-
42-
expect(clientDimensions).toHaveProperty('width');
43-
expect(typeof clientDimensions.width).toBe('number');
44-
expect(clientDimensions).toHaveProperty('height');
45-
expect(typeof clientDimensions.height).toBe('number');
46-
47-
// Get result of script executed in browser context
48-
const scriptResult = await page.evaluate(
49-
numbers => {
50-
const result = numbers.reduce(
51-
(accumulator, currentValue) => accumulator + currentValue
52-
);
53-
54-
return Promise.resolve(result);
55-
},
56-
[1, 2, 3]
57-
);
58-
59-
expect(scriptResult).toBe(6);
60-
61-
// Get result of local function executed in browser context
62-
function add(...addends) {
63-
return addends.reduce(
64-
(accumulator, currentValue) => accumulator + currentValue
65-
);
66-
}
67-
68-
const functionResult = await page.evaluate(`
69-
const add = ${add.toString()};
70-
71-
const result = add(1, 2, 3);
72-
73-
Promise.resolve(result);
74-
`);
75-
76-
expect(functionResult).toBe(6);
77-
});
78-
4+
test.describe('Creating a Docsify site (e2e tests in Playwright)', () => {
795
test('manual docsify site using playwright methods', async ({ page }) => {
806
// Add docsify target element
817
await page.setContent('<div id="app"></div>');

Diff for: test/integration/example.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { waitForFunction, waitForText } from '../helpers/wait-for.js';
22
import docsifyInit from '../helpers/docsify-init.js';
33

4-
// Suite
5-
// -----------------------------------------------------------------------------
6-
describe('Example Tests', function () {
7-
// Tests
8-
// ---------------------------------------------------------------------------
4+
describe('Creating a Docsify site (integration tests in Jest)', function () {
95
test('Docsify /docs/ site using docsifyInit()', async () => {
106
await docsifyInit({
117
config: {

Diff for: test/unit/__snapshots__/example.test.js.snap

-3
This file was deleted.

Diff for: test/unit/example.test.js

-138
This file was deleted.

Diff for: test/unit/fixtures/get-time-of-day.js

-6
This file was deleted.

Diff for: test/unit/fixtures/greet.js

-7
This file was deleted.

0 commit comments

Comments
 (0)