mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
chore: move tests that starts with i and j (#10129)
* chore: move tests that starts with i and j * add missing `after`
This commit is contained in:
parent
d278e66ec6
commit
4f6b0def42
7 changed files with 37 additions and 30 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, it, before } from 'node:test';
|
||||||
import { testImageService } from './test-image-service.js';
|
import { testImageService } from './test-image-service.js';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
|
@ -20,17 +21,17 @@ describe('astro:assets - delete images that are unused', () => {
|
||||||
|
|
||||||
it('should delete images that are only used for optimization', async () => {
|
it('should delete images that are only used for optimization', async () => {
|
||||||
const imagesOnlyOptimized = await fixture.glob('_astro/onlyone.*.*');
|
const imagesOnlyOptimized = await fixture.glob('_astro/onlyone.*.*');
|
||||||
expect(imagesOnlyOptimized).to.have.lengthOf(1);
|
assert.equal(imagesOnlyOptimized.length, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not delete images that are used in other contexts', async () => {
|
it('should not delete images that are used in other contexts', async () => {
|
||||||
const imagesUsedElsewhere = await fixture.glob('_astro/twoofus.*.*');
|
const imagesUsedElsewhere = await fixture.glob('_astro/twoofus.*.*');
|
||||||
expect(imagesUsedElsewhere).to.have.lengthOf(2);
|
assert.equal(imagesUsedElsewhere.length, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not delete images that are also used through query params', async () => {
|
it('should not delete images that are also used through query params', async () => {
|
||||||
const imagesUsedElsewhere = await fixture.glob('_astro/url.*.*');
|
const imagesUsedElsewhere = await fixture.glob('_astro/url.*.*');
|
||||||
expect(imagesUsedElsewhere).to.have.lengthOf(2);
|
assert.equal(imagesUsedElsewhere.length, 2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,12 +1,13 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, it } from 'node:test';
|
||||||
|
|
||||||
describe('Import astro/app', async () => {
|
describe('Import astro/app', async () => {
|
||||||
it('Successfully imports astro/app', async () => {
|
it('Successfully imports astro/app', async () => {
|
||||||
try {
|
try {
|
||||||
await import('astro/app');
|
await import('astro/app');
|
||||||
expect(true).to.be.true;
|
assert.equal(true, true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect.fail(undefined, undefined, `Importing astro/app should not throw an error: ${err}`);
|
assert.fail(undefined, undefined, `Importing astro/app should not throw an error: ${err}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, before, it } from 'node:test';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
|
@ -14,6 +15,6 @@ describe('Using .js extension on .ts file', () => {
|
||||||
it('works in .astro files', async () => {
|
it('works in .astro files', async () => {
|
||||||
const html = await fixture.readFile('/index.html');
|
const html = await fixture.readFile('/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
expect($('h1').text()).to.equal('bar');
|
assert.equal($('h1').text(), 'bar');
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, before, it, after } from 'node:test';
|
||||||
import { isWindows, loadFixture } from './test-utils.js';
|
import { isWindows, loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
let fixture;
|
let fixture;
|
||||||
|
@ -25,7 +26,7 @@ describe('Impostor MDX File', () => {
|
||||||
|
|
||||||
it('does not crash when loading react component with .md or .mdx in name', async () => {
|
it('does not crash when loading react component with .md or .mdx in name', async () => {
|
||||||
const result = await fixture.fetch('/').then((response) => response.text());
|
const result = await fixture.fetch('/').then((response) => response.text());
|
||||||
expect(result).to.contain('Baz');
|
assert.equal(result.includes('Baz'), true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, before, it } from 'node:test';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
|
@ -14,6 +15,6 @@ describe('Integration addPageExtension', () => {
|
||||||
it('supports .mjs files', async () => {
|
it('supports .mjs files', async () => {
|
||||||
const html = await fixture.readFile('/test/index.html');
|
const html = await fixture.readFile('/test/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
expect($('h1').text()).to.equal('Hello world!');
|
assert.equal($('h1').text(), 'Hello world!');
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, before, it, after } from 'node:test';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
describe('Integration server setup', () => {
|
describe('Integration server setup', () => {
|
||||||
|
@ -19,6 +20,6 @@ describe('Integration server setup', () => {
|
||||||
it('Adds middlewares in dev', async () => {
|
it('Adds middlewares in dev', async () => {
|
||||||
const res = await fixture.fetch('/');
|
const res = await fixture.fetch('/');
|
||||||
|
|
||||||
expect(res.headers.get('x-middleware')).to.equal('true');
|
assert.equal(res.headers.get('x-middleware'), 'true');
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import assert from 'node:assert/strict';
|
||||||
|
import { describe, before, it } from 'node:test';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
|
@ -16,55 +17,55 @@ describe('jsx-runtime', () => {
|
||||||
const html = await fixture.readFile('/component/index.html');
|
const html = await fixture.readFile('/component/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#basic').text()).to.equal('Basic');
|
assert.equal($('#basic').text(), 'Basic');
|
||||||
expect($('#named').text()).to.equal('Named');
|
assert.equal($('#named').text(), 'Named');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load Preact component inside Astro', async () => {
|
it('Can load Preact component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#has-preact #preact').length).to.equal(0);
|
assert.equal($('#has-preact #preact').length, 0);
|
||||||
expect($('#preact').text()).to.include('Preact');
|
assert.equal($('#preact').text().includes('Preact'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load React component inside Astro', async () => {
|
it('Can load React component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#has-react #react').length).to.equal(0);
|
assert.equal($('#has-react #react').length, 0);
|
||||||
expect($('#react').text()).to.include('React');
|
assert.equal($('#react').text().includes('React'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load Solid component inside Astro', async () => {
|
it('Can load Solid component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#has-solid #solid').length).to.equal(0);
|
assert.equal($('#has-solid #solid').length, 0);
|
||||||
expect($('#solid').text()).to.include('Solid');
|
assert.equal($('#solid').text().includes('Solid'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load Svelte component inside Astro', async () => {
|
it('Can load Svelte component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#has-svelte #svelte').length).to.equal(0);
|
assert.equal($('#has-svelte #svelte').length, 0);
|
||||||
expect($('#svelte').text()).to.include('Svelte');
|
assert.equal($('#svelte').text().includes('Svelte'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load Vue component inside Astro', async () => {
|
it('Can load Vue component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#has-vue #vue').length).to.equal(0);
|
assert.equal($('#has-vue #vue').length, 0);
|
||||||
expect($('#vue').text()).to.include('Vue');
|
assert.equal($('#vue').text().includes('Vue'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can load MDX component inside Astro', async () => {
|
it('Can load MDX component inside Astro', async () => {
|
||||||
const html = await fixture.readFile('/frameworks/index.html');
|
const html = await fixture.readFile('/frameworks/index.html');
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('#mdx-wrapper #hello-world')).to.have.a.lengthOf(1, 'md content rendered');
|
assert.equal($('#mdx-wrapper #hello-world').length, 1, 'md content rendered');
|
||||||
expect($('#mdx-wrapper #react')).to.have.a.lengthOf(1, 'React component rendered');
|
assert.equal($('#mdx-wrapper #react').length, 1, 'React component rendered');
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue