mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
chore: Change strictEqual
to equal
(#10140)
This commit is contained in:
parent
7bdcfb750a
commit
5ff288f61b
22 changed files with 152 additions and 158 deletions
|
@ -47,7 +47,7 @@ describe('pagesGlobToRssItems', () => {
|
|||
},
|
||||
];
|
||||
|
||||
assert.deepStrictEqual(
|
||||
assert.deepEqual(
|
||||
items.sort((a, b) => a.pubDate - b.pubDate),
|
||||
expected
|
||||
);
|
||||
|
|
|
@ -36,9 +36,9 @@ function assertXmlDeepEqual(a, b) {
|
|||
const parsedA = parseXmlString(a);
|
||||
const parsedB = parseXmlString(b);
|
||||
|
||||
assert.strictEqual(parsedA.err, null);
|
||||
assert.strictEqual(parsedB.err, null);
|
||||
assert.deepStrictEqual(parsedA.result, parsedB.result);
|
||||
assert.equal(parsedA.err, null);
|
||||
assert.equal(parsedB.err, null);
|
||||
assert.deepEqual(parsedA.result, parsedB.result);
|
||||
}
|
||||
|
||||
describe('rss', () => {
|
||||
|
@ -58,7 +58,7 @@ describe('rss', () => {
|
|||
assertXmlDeepEqual(str, validXmlResult);
|
||||
|
||||
const contentType = response.headers.get('Content-Type');
|
||||
assert.strictEqual(contentType, 'application/xml');
|
||||
assert.equal(contentType, 'application/xml');
|
||||
});
|
||||
|
||||
it('should be the same string as getRssString', async () => {
|
||||
|
@ -73,7 +73,7 @@ describe('rss', () => {
|
|||
const str1 = await response.text();
|
||||
const str2 = await getRssString(options);
|
||||
|
||||
assert.strictEqual(str1, str2);
|
||||
assert.equal(str1, str2);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -223,8 +223,8 @@ describe('getRssString', () => {
|
|||
link: phpFeedItem.link,
|
||||
});
|
||||
|
||||
assert.strictEqual(res.success, false);
|
||||
assert.strictEqual(res.error.issues[0].path[0], 'pubDate');
|
||||
assert.equal(res.success, false);
|
||||
assert.equal(res.error.issues[0].path[0], 'pubDate');
|
||||
});
|
||||
|
||||
it('should be extendable', () => {
|
||||
|
@ -236,7 +236,7 @@ describe('getRssString', () => {
|
|||
} catch (e) {
|
||||
error = e.message;
|
||||
}
|
||||
assert.strictEqual(error, null);
|
||||
assert.equal(error, null);
|
||||
});
|
||||
|
||||
it('should not fail when an enclosure has a length of 0', async () => {
|
||||
|
@ -264,6 +264,6 @@ describe('getRssString', () => {
|
|||
error = e.message;
|
||||
}
|
||||
|
||||
assert.strictEqual(error, null);
|
||||
assert.equal(error, null);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -97,7 +97,7 @@ describe('Astro basic build', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// will be 1 if element rendered correctly
|
||||
assert.strictEqual($('#one').length, 1);
|
||||
assert.equal($('#one').length, 1);
|
||||
});
|
||||
|
||||
it('supports special chars in filename', async () => {
|
||||
|
@ -108,19 +108,19 @@ describe('Astro basic build', () => {
|
|||
it('renders the components top-down', async () => {
|
||||
const html = await fixture.readFile('/order/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('#rendered-order').text(), 'Rendered order: A, B');
|
||||
assert.equal($('#rendered-order').text(), 'Rendered order: A, B');
|
||||
});
|
||||
|
||||
it('renders markdown in utf-8 by default', async () => {
|
||||
const html = await fixture.readFile('/chinese-encoding-md/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').text(), '我的第一篇博客文章');
|
||||
assert.equal($('h1').text(), '我的第一篇博客文章');
|
||||
});
|
||||
|
||||
it('renders MDX in utf-8 by default', async () => {
|
||||
const html = await fixture.readFile('/chinese-encoding-mdx/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').text(), '我的第一篇博客文章');
|
||||
assert.equal($('h1').text(), '我的第一篇博客文章');
|
||||
});
|
||||
|
||||
it('Supports void elements whose name is a string (#2062)', async () => {
|
||||
|
@ -128,25 +128,22 @@ describe('Astro basic build', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// <Input />
|
||||
assert.strictEqual($('body > :nth-child(1)').prop('outerHTML'), '<input>');
|
||||
assert.equal($('body > :nth-child(1)').prop('outerHTML'), '<input>');
|
||||
|
||||
// <Input type="password" />
|
||||
assert.strictEqual($('body > :nth-child(2)').prop('outerHTML'), '<input type="password">');
|
||||
assert.equal($('body > :nth-child(2)').prop('outerHTML'), '<input type="password">');
|
||||
|
||||
// <Input type="text" />
|
||||
assert.strictEqual($('body > :nth-child(3)').prop('outerHTML'), '<input type="text">');
|
||||
assert.equal($('body > :nth-child(3)').prop('outerHTML'), '<input type="text">');
|
||||
|
||||
// <Input type="select"><option>option</option></Input>
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('body > :nth-child(4)').prop('outerHTML'),
|
||||
'<select><option>option</option></select>'
|
||||
);
|
||||
|
||||
// <Input type="textarea">textarea</Input>
|
||||
assert.strictEqual(
|
||||
$('body > :nth-child(5)').prop('outerHTML'),
|
||||
'<textarea>textarea</textarea>'
|
||||
);
|
||||
assert.equal($('body > :nth-child(5)').prop('outerHTML'), '<textarea>textarea</textarea>');
|
||||
});
|
||||
|
||||
it('Generates pages that end with .mjs', async () => {
|
||||
|
@ -159,18 +156,18 @@ describe('Astro basic build', () => {
|
|||
it('allows file:// urls as module specifiers', async () => {
|
||||
const html = await fixture.readFile('/fileurl/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').text(), 'WORKS');
|
||||
assert.equal($('h1').text(), 'WORKS');
|
||||
});
|
||||
|
||||
describe('preview', () => {
|
||||
it('returns 200 for valid URLs', async () => {
|
||||
const result = await fixture.fetch('/');
|
||||
assert.strictEqual(result.status, 200);
|
||||
assert.equal(result.status, 200);
|
||||
});
|
||||
|
||||
it('returns 404 for invalid URLs', async () => {
|
||||
const result = await fixture.fetch('/bad-url');
|
||||
assert.strictEqual(result.status, 404);
|
||||
assert.equal(result.status, 404);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -193,7 +190,7 @@ describe('Astro basic development', () => {
|
|||
|
||||
it('Renders markdown in utf-8 by default', async () => {
|
||||
const res = await fixture.fetch('/chinese-encoding-md');
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.equal(res.status, 200);
|
||||
const html = await res.text();
|
||||
const $ = cheerio.load(html);
|
||||
assert.equal($('h1').text(), '我的第一篇博客文章');
|
||||
|
@ -205,7 +202,7 @@ describe('Astro basic development', () => {
|
|||
|
||||
it('Renders MDX in utf-8 by default', async () => {
|
||||
const res = await fixture.fetch('/chinese-encoding-mdx');
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.equal(res.status, 200);
|
||||
const html = await res.text();
|
||||
const $ = cheerio.load(html);
|
||||
assert.equal($('h1').text(), '我的第一篇博客文章');
|
||||
|
|
|
@ -17,15 +17,15 @@ describe('Component children', () => {
|
|||
|
||||
// test 1: Can pass text to Preact components
|
||||
const $preact = $('#preact');
|
||||
assert.strictEqual($preact.text().trim(), 'Hello world');
|
||||
assert.equal($preact.text().trim(), 'Hello world');
|
||||
|
||||
// test 2: Can pass text to Vue components
|
||||
const $vue = $('#vue');
|
||||
assert.strictEqual($vue.text().trim(), 'Hello world');
|
||||
assert.equal($vue.text().trim(), 'Hello world');
|
||||
|
||||
// test 3: Can pass text to Svelte components
|
||||
const $svelte = $('#svelte');
|
||||
assert.strictEqual($svelte.text().trim(), 'Hello world');
|
||||
assert.equal($svelte.text().trim(), 'Hello world');
|
||||
});
|
||||
|
||||
it('Passes markup children to framework components', async () => {
|
||||
|
@ -34,15 +34,15 @@ describe('Component children', () => {
|
|||
|
||||
// test 1: Can pass markup to Preact components
|
||||
const $preact = $('#preact h1');
|
||||
assert.strictEqual($preact.text().trim(), 'Hello world');
|
||||
assert.equal($preact.text().trim(), 'Hello world');
|
||||
|
||||
// test 2: Can pass markup to Vue components
|
||||
const $vue = $('#vue h1');
|
||||
assert.strictEqual($vue.text().trim(), 'Hello world');
|
||||
assert.equal($vue.text().trim(), 'Hello world');
|
||||
|
||||
// test 3: Can pass markup to Svelte components
|
||||
const $svelte = $('#svelte h1');
|
||||
assert.strictEqual($svelte.text().trim(), 'Hello world');
|
||||
assert.equal($svelte.text().trim(), 'Hello world');
|
||||
});
|
||||
|
||||
it('Passes multiple children to framework components', async () => {
|
||||
|
@ -51,21 +51,21 @@ describe('Component children', () => {
|
|||
|
||||
// test 1: Can pass multiple children to Preact components
|
||||
const $preact = $('#preact');
|
||||
assert.strictEqual($preact.children().length, 2);
|
||||
assert.strictEqual($preact.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.strictEqual($preact.children(':last-child').text().trim(), 'Goodbye world');
|
||||
assert.equal($preact.children().length, 2);
|
||||
assert.equal($preact.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.equal($preact.children(':last-child').text().trim(), 'Goodbye world');
|
||||
|
||||
// test 2: Can pass multiple children to Vue components
|
||||
const $vue = $('#vue');
|
||||
assert.strictEqual($vue.children().length, 2);
|
||||
assert.strictEqual($vue.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.strictEqual($vue.children(':last-child').text().trim(), 'Goodbye world');
|
||||
assert.equal($vue.children().length, 2);
|
||||
assert.equal($vue.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.equal($vue.children(':last-child').text().trim(), 'Goodbye world');
|
||||
|
||||
// test 3: Can pass multiple children to Svelte components
|
||||
const $svelte = $('#svelte');
|
||||
assert.strictEqual($svelte.children().length, 2);
|
||||
assert.strictEqual($svelte.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.strictEqual($svelte.children(':last-child').text().trim(), 'Goodbye world');
|
||||
assert.equal($svelte.children().length, 2);
|
||||
assert.equal($svelte.children(':first-child').text().trim(), 'Hello world');
|
||||
assert.equal($svelte.children(':last-child').text().trim(), 'Goodbye world');
|
||||
});
|
||||
|
||||
it('Renders a template when children are not rendered for client components', async () => {
|
||||
|
@ -73,26 +73,26 @@ describe('Component children', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// test 1: If SSR only, no children are rendered.
|
||||
assert.strictEqual($('#ssr-only').children().length, 0);
|
||||
assert.equal($('#ssr-only').children().length, 0);
|
||||
|
||||
// test 2: If client, and no children are rendered, a template is.
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('#client').parent().children().length,
|
||||
2,
|
||||
'rendered the client component and a template'
|
||||
);
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('#client').parent().find('template[data-astro-template]').length,
|
||||
1,
|
||||
'Found 1 template'
|
||||
);
|
||||
|
||||
// test 3: If client, and children are rendered, no template is.
|
||||
assert.strictEqual($('#client-render').parent().children().length, 1);
|
||||
assert.strictEqual($('#client-render').parent().find('template').length, 0);
|
||||
assert.equal($('#client-render').parent().children().length, 1);
|
||||
assert.equal($('#client-render').parent().find('template').length, 0);
|
||||
|
||||
// test 4: If client and no children are provided, no template is.
|
||||
assert.strictEqual($('#client-no-children').parent().children().length, 1);
|
||||
assert.strictEqual($('#client-no-children').parent().find('template').length, 0);
|
||||
assert.equal($('#client-no-children').parent().children().length, 1);
|
||||
assert.equal($('#client-no-children').parent().find('template').length, 0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('Astro Markdown - frontmatter injection', () => {
|
|||
);
|
||||
assert.ok(readingTimes.length > 0);
|
||||
for (let readingTime of readingTimes) {
|
||||
assert.notStrictEqual(readingTime, null);
|
||||
assert.notEqual(readingTime, null);
|
||||
assert.match(readingTime.text, /^\d+ min read/);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('Astro Markdown plugins', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// test 1: Added a TOC
|
||||
assert.strictEqual($('.toc').length, 1);
|
||||
assert.equal($('.toc').length, 1);
|
||||
|
||||
// test 2: Added .title to h1
|
||||
assert.ok($('#hello-world').hasClass('title'));
|
||||
|
@ -56,11 +56,11 @@ describe('Astro Markdown plugins', () => {
|
|||
it('Still applies default plugins when user plugins are provided', async () => {
|
||||
const gfmHtml = await fixture.readFile('/with-gfm/index.html');
|
||||
const $1 = cheerio.load(gfmHtml);
|
||||
assert.strictEqual($1('a[href="https://example.com"]').length, 1);
|
||||
assert.equal($1('a[href="https://example.com"]').length, 1);
|
||||
|
||||
const smartypantsHtml = await fixture.readFile('/with-smartypants/index.html');
|
||||
const $2 = cheerio.load(smartypantsHtml);
|
||||
assert.strictEqual($2('p').html(), '“Smartypants” is — awesome');
|
||||
assert.equal($2('p').html(), '“Smartypants” is — awesome');
|
||||
|
||||
testRemark(gfmHtml);
|
||||
testRehype(gfmHtml, '#github-flavored-markdown-test');
|
||||
|
@ -71,7 +71,7 @@ describe('Astro Markdown plugins', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// test 1: GFM autolink applied correctly
|
||||
assert.strictEqual($('a[href="https://example.com"]').length, 1);
|
||||
assert.equal($('a[href="https://example.com"]').length, 1);
|
||||
|
||||
testRemark(html);
|
||||
testRehype(html, '#github-flavored-markdown-test');
|
||||
|
@ -82,7 +82,7 @@ describe('Astro Markdown plugins', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// test 1: smartypants applied correctly
|
||||
assert.strictEqual($('p').html(), '“Smartypants” is — awesome');
|
||||
assert.equal($('p').html(), '“Smartypants” is — awesome');
|
||||
|
||||
testRemark(html);
|
||||
testRehype(html, '#smartypants-test');
|
||||
|
@ -99,7 +99,7 @@ describe('Astro Markdown plugins', () => {
|
|||
const html = await fixture.readFile('/with-gfm/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('a[href="https://example.com"]').length, 0);
|
||||
assert.equal($('a[href="https://example.com"]').length, 0);
|
||||
|
||||
testRemark(html);
|
||||
testRehype(html, '#github-flavored-markdown-test');
|
||||
|
@ -115,7 +115,7 @@ describe('Astro Markdown plugins', () => {
|
|||
const html = await fixture.readFile('/with-smartypants/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('p').html(), '"Smartypants" is -- awesome');
|
||||
assert.equal($('p').html(), '"Smartypants" is -- awesome');
|
||||
|
||||
testRemark(html);
|
||||
testRehype(html, '#smartypants-test');
|
||||
|
@ -124,7 +124,7 @@ describe('Astro Markdown plugins', () => {
|
|||
|
||||
function testRehype(html, headingId) {
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($(headingId).length, 1);
|
||||
assert.equal($(headingId).length, 1);
|
||||
assert.ok($(headingId).hasClass('title'));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,8 @@ describe('Astro Markdown without remark-rehype config', () => {
|
|||
it('Renders footnotes with default English labels', async () => {
|
||||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('#footnote-label').text(), 'Footnotes');
|
||||
assert.strictEqual(
|
||||
$('.data-footnote-backref').first().attr('aria-label'),
|
||||
'Back to reference 1'
|
||||
);
|
||||
assert.equal($('#footnote-label').text(), 'Footnotes');
|
||||
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Back to reference 1');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -41,7 +38,7 @@ describe('Astro Markdown with remark-rehype config', () => {
|
|||
it('Renders footnotes with values from the configuration', async () => {
|
||||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('#footnote-label').text(), 'Catatan kaki');
|
||||
assert.strictEqual($('.data-footnote-backref').first().attr('aria-label'), 'Kembali ke konten');
|
||||
assert.equal($('#footnote-label').text(), 'Catatan kaki');
|
||||
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Kembali ke konten');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,11 +17,11 @@ describe('Astro Markdown Shiki', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// There should be no HTML from Prism
|
||||
assert.strictEqual($('.token').length, 0);
|
||||
assert.equal($('.token').length, 0);
|
||||
|
||||
assert.strictEqual($('pre').length, 2);
|
||||
assert.equal($('pre').length, 2);
|
||||
assert.ok($('pre').hasClass('astro-code'));
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('pre').attr().style,
|
||||
'background-color:#24292e;color:#e1e4e8; overflow-x: auto;'
|
||||
);
|
||||
|
@ -49,9 +49,9 @@ describe('Astro Markdown Shiki', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 1);
|
||||
assert.equal($('pre').length, 1);
|
||||
assert.ok($('pre').hasClass('astro-code'));
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('pre').attr().style,
|
||||
'background-color:#fff;color:#24292e; overflow-x: auto;'
|
||||
);
|
||||
|
@ -70,9 +70,9 @@ describe('Astro Markdown Shiki', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 1);
|
||||
assert.equal($('pre').length, 1);
|
||||
assert.ok($('pre').hasClass('astro-code'));
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
$('pre').attr().style,
|
||||
'background-color:#FDFDFE;color:#4E5377; overflow-x: auto;'
|
||||
);
|
||||
|
@ -93,9 +93,9 @@ describe('Astro Markdown Shiki', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
const segments = $('.line').get(6).children;
|
||||
assert.strictEqual(segments.length, 2);
|
||||
assert.strictEqual(segments[0].attribs.style, 'color:#79B8FF');
|
||||
assert.strictEqual(segments[1].attribs.style, 'color:#E1E4E8');
|
||||
assert.equal(segments.length, 2);
|
||||
assert.equal(segments[0].attribs.style, 'color:#79B8FF');
|
||||
assert.equal(segments[1].attribs.style, 'color:#E1E4E8');
|
||||
|
||||
const unknownLang = $('.astro-code').get(1);
|
||||
assert.ok(unknownLang.attribs.style.includes('background-color:#24292e;color:#e1e4e8;'));
|
||||
|
@ -130,8 +130,8 @@ describe('Astro Markdown Shiki', () => {
|
|||
const html = await fixtures.ifTrue.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 1);
|
||||
assert.strictEqual($('pre').attr('style'), style);
|
||||
assert.equal($('pre').length, 1);
|
||||
assert.equal($('pre').attr('style'), style);
|
||||
});
|
||||
|
||||
it('Markdown file with wrap = false', async () => {
|
||||
|
@ -139,8 +139,8 @@ describe('Astro Markdown Shiki', () => {
|
|||
const html = await fixtures.ifFalse.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 1);
|
||||
assert.strictEqual($('pre').attr('style'), style);
|
||||
assert.equal($('pre').length, 1);
|
||||
assert.equal($('pre').attr('style'), style);
|
||||
});
|
||||
|
||||
it('Markdown file with wrap = null', async () => {
|
||||
|
@ -148,8 +148,8 @@ describe('Astro Markdown Shiki', () => {
|
|||
const html = await fixtures.ifNull.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 1);
|
||||
assert.strictEqual($('pre').attr('style'), style);
|
||||
assert.equal($('pre').length, 1);
|
||||
assert.equal($('pre').attr('style'), style);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl + '/');
|
||||
assert.equal($('#url').attr('href'), baseUrl + '/');
|
||||
});
|
||||
|
||||
it('trailingSlash: never', async () => {
|
||||
|
@ -34,7 +34,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl);
|
||||
assert.equal($('#url').attr('href'), baseUrl);
|
||||
});
|
||||
|
||||
it('trailingSlash: ignore', async () => {
|
||||
|
@ -49,7 +49,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl);
|
||||
assert.equal($('#url').attr('href'), baseUrl);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl + '/');
|
||||
assert.equal($('#url').attr('href'), baseUrl + '/');
|
||||
});
|
||||
|
||||
it('trailingSlash: never', async () => {
|
||||
|
@ -81,7 +81,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl);
|
||||
assert.equal($('#url').attr('href'), baseUrl);
|
||||
});
|
||||
|
||||
it('trailingSlash: ignore', async () => {
|
||||
|
@ -95,7 +95,7 @@ describe('Astro Markdown URL', () => {
|
|||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('#url').attr('href'), baseUrl);
|
||||
assert.equal($('#url').attr('href'), baseUrl);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('Astro Markdown', () => {
|
|||
it('Exposes raw markdown content', async () => {
|
||||
const { raw } = JSON.parse(await fixture.readFile('/raw-content.json'));
|
||||
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
fixLineEndings(raw).trim(),
|
||||
`# Basic page\n\nLets make sure raw and compiled content look right!`
|
||||
);
|
||||
|
@ -27,7 +27,7 @@ describe('Astro Markdown', () => {
|
|||
it('Exposes compiled HTML content', async () => {
|
||||
const { compiled } = JSON.parse(await fixture.readFile('/raw-content.json'));
|
||||
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
fixLineEndings(compiled).trim(),
|
||||
`<h1 id="basic-page">Basic page</h1>\n<p>Lets make sure raw and compiled content look right!</p>`
|
||||
);
|
||||
|
@ -38,7 +38,7 @@ describe('Astro Markdown', () => {
|
|||
const html = await fixture.readFile('/code-in-md/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.notStrictEqual($('pre.astro-code').length, 0);
|
||||
assert.notEqual($('pre.astro-code').length, 0);
|
||||
});
|
||||
|
||||
it('handles Prism', async () => {
|
||||
|
@ -53,7 +53,7 @@ describe('Astro Markdown', () => {
|
|||
const html = await prismFixture.readFile('/code-in-md/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.notStrictEqual($('pre.language-html').length, 0);
|
||||
assert.notEqual($('pre.language-html').length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -64,8 +64,8 @@ describe('Astro Markdown', () => {
|
|||
const contentTitle = $('[data-content-title]');
|
||||
const frontmatterTitle = $('[data-frontmatter-title]');
|
||||
|
||||
assert.strictEqual(contentTitle.text(), 'With layout');
|
||||
assert.strictEqual(frontmatterTitle.text(), 'With layout');
|
||||
assert.equal(contentTitle.text(), 'With layout');
|
||||
assert.equal(frontmatterTitle.text(), 'With layout');
|
||||
});
|
||||
|
||||
it('Passes headings to layout via "headings" prop', async () => {
|
||||
|
@ -85,7 +85,7 @@ describe('Astro Markdown', () => {
|
|||
|
||||
const compiledContent = $('[data-compiled-content]');
|
||||
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
fixLineEndings(compiledContent.text()).trim(),
|
||||
`<h2 id="section-1">Section 1</h2>\n<h2 id="section-2">Section 2</h2>`
|
||||
);
|
||||
|
@ -97,7 +97,7 @@ describe('Astro Markdown', () => {
|
|||
|
||||
const rawContent = $('[data-raw-content]');
|
||||
|
||||
assert.strictEqual(fixLineEndings(rawContent.text()).trim(), `## Section 1\n\n## Section 2`);
|
||||
assert.equal(fixLineEndings(rawContent.text()).trim(), `## Section 1\n\n## Section 2`);
|
||||
});
|
||||
|
||||
it('Exposes getHeadings() on glob imports', async () => {
|
||||
|
@ -118,14 +118,14 @@ describe('Astro Markdown', () => {
|
|||
const file = $('[data-file]')?.text();
|
||||
const url = $('[data-url]')?.text();
|
||||
|
||||
assert.strictEqual(
|
||||
assert.equal(
|
||||
frontmatterFile?.endsWith('with-layout.md'),
|
||||
true,
|
||||
'"file" prop does not end with correct path or is undefined'
|
||||
);
|
||||
assert.strictEqual(frontmatterUrl, '/with-layout');
|
||||
assert.strictEqual(file, frontmatterFile);
|
||||
assert.strictEqual(url, frontmatterUrl);
|
||||
assert.equal(frontmatterUrl, '/with-layout');
|
||||
assert.equal(file, frontmatterFile);
|
||||
assert.equal(url, frontmatterUrl);
|
||||
});
|
||||
|
||||
describe('Vite env vars (#3412)', () => {
|
||||
|
@ -134,18 +134,18 @@ describe('Astro Markdown', () => {
|
|||
const $ = cheerio.load(html);
|
||||
|
||||
// test 1: referencing an existing var name
|
||||
assert.strictEqual($('code').eq(0).text(), 'import.meta.env.SITE');
|
||||
assert.strictEqual($('li').eq(0).text(), 'import.meta.env.SITE');
|
||||
assert.equal($('code').eq(0).text(), 'import.meta.env.SITE');
|
||||
assert.equal($('li').eq(0).text(), 'import.meta.env.SITE');
|
||||
assert.ok($('code').eq(3).text().includes('site: import.meta.env.SITE'));
|
||||
|
||||
// // test 2: referencing a non-existing var name
|
||||
assert.strictEqual($('code').eq(1).text(), 'import.meta.env.TITLE');
|
||||
assert.strictEqual($('li').eq(1).text(), 'import.meta.env.TITLE');
|
||||
assert.equal($('code').eq(1).text(), 'import.meta.env.TITLE');
|
||||
assert.equal($('li').eq(1).text(), 'import.meta.env.TITLE');
|
||||
assert.ok($('code').eq(3).text().includes('title: import.meta.env.TITLE'));
|
||||
|
||||
// // test 3: referencing `import.meta.env` itself (without any var name)
|
||||
assert.strictEqual($('code').eq(2).text(), 'import.meta.env');
|
||||
assert.strictEqual($('li').eq(2).text(), 'import.meta.env');
|
||||
assert.equal($('code').eq(2).text(), 'import.meta.env');
|
||||
assert.equal($('li').eq(2).text(), 'import.meta.env');
|
||||
assert.ok($('code').eq(3).text().includes('// Use Vite env vars with import.meta.env'));
|
||||
});
|
||||
it('Allows referencing import.meta.env in frontmatter', async () => {
|
||||
|
|
|
@ -29,18 +29,18 @@ describe('Custom 404.html', () => {
|
|||
const html = await fixture.fetch('/').then((res) => res.text());
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Home');
|
||||
assert.equal($('h1').text(), 'Home');
|
||||
});
|
||||
|
||||
it('renders 404 for /a', async () => {
|
||||
const res = await fixture.fetch('/a');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.equal(res.status, 404);
|
||||
|
||||
const html = await res.text();
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Page not found');
|
||||
assert.strictEqual($('p').text(), 'This 404 is a static HTML file.');
|
||||
assert.equal($('h1').text(), 'Page not found');
|
||||
assert.equal($('p').text(), 'This 404 is a static HTML file.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,8 +27,8 @@ for (const caseNumber of [1, 2, 3, 4]) {
|
|||
async () => {
|
||||
const resPromise = fixture.fetch('/');
|
||||
const result = await withTimeout(resPromise, 1000);
|
||||
assert.notStrictEqual(result, timeout);
|
||||
assert.strictEqual(result.status, 200);
|
||||
assert.notEqual(result, timeout);
|
||||
assert.equal(result.status, 200);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -40,8 +40,8 @@ for (const caseNumber of [1, 2, 3, 4]) {
|
|||
async () => {
|
||||
const resPromise = fixture.fetch('/alvsibdlvjks');
|
||||
const result = await withTimeout(resPromise, 1000);
|
||||
assert.notStrictEqual(result, timeout);
|
||||
assert.strictEqual(result.status, 404);
|
||||
assert.notEqual(result, timeout);
|
||||
assert.equal(result.status, 404);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('Custom 404 with injectRoute from dependency', () => {
|
|||
|
||||
it('Build succeeds', async () => {
|
||||
const html = await fixture.readFile('/404.html');
|
||||
assert.strictEqual(html.includes('<!DOCTYPE html>'), true);
|
||||
assert.equal(html.includes('<!DOCTYPE html>'), true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,18 +29,18 @@ describe('Custom 404 with injectRoute', () => {
|
|||
const html = await fixture.fetch('/').then((res) => res.text());
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Home');
|
||||
assert.equal($('h1').text(), 'Home');
|
||||
});
|
||||
|
||||
it('renders 404 for /a', async () => {
|
||||
const res = await fixture.fetch('/a');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.equal(res.status, 404);
|
||||
|
||||
const html = await res.text();
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Page not found');
|
||||
assert.strictEqual($('p').text(), '/a');
|
||||
assert.equal($('h1').text(), 'Page not found');
|
||||
assert.equal($('p').text(), '/a');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,17 +28,17 @@ describe('Custom 404 Markdown', () => {
|
|||
const html = await fixture.fetch('/').then((res) => res.text());
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Home');
|
||||
assert.equal($('h1').text(), 'Home');
|
||||
});
|
||||
|
||||
it('renders 404 for /abc', async () => {
|
||||
const res = await fixture.fetch('/a');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.equal(res.status, 404);
|
||||
|
||||
const html = await res.text();
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Page not found');
|
||||
assert.equal($('h1').text(), 'Page not found');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,18 +29,18 @@ describe('Custom 404 with Static', () => {
|
|||
const html = await fixture.fetch('/').then((res) => res.text());
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Home');
|
||||
assert.equal($('h1').text(), 'Home');
|
||||
});
|
||||
|
||||
it('renders 404 for /a', async () => {
|
||||
const res = await fixture.fetch('/a');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.equal(res.status, 404);
|
||||
|
||||
const html = await res.text();
|
||||
$ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('h1').text(), 'Page not found');
|
||||
assert.strictEqual($('p').text(), '/a');
|
||||
assert.equal($('h1').text(), 'Page not found');
|
||||
assert.equal($('p').text(), '/a');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -21,52 +21,52 @@ describe('Markdown tests', () => {
|
|||
it('Can load a markdown page with the `.markdown` extension', async () => {
|
||||
const html = await fixture.readFile('/dot-markdown-page/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').html(), 'Page with alternative .markdown extension');
|
||||
assert.strictEqual($('p').html(), 'Hope this loads fine 🤞');
|
||||
assert.equal($('h1').html(), 'Page with alternative .markdown extension');
|
||||
assert.equal($('p').html(), 'Hope this loads fine 🤞');
|
||||
});
|
||||
|
||||
it('Can load a markdown page with the `.mdwn` extension', async () => {
|
||||
const html = await fixture.readFile('/dot-mdwn-page/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').html(), 'Page with alternative .mdwn extension');
|
||||
assert.strictEqual($('p').html(), 'Hope this loads fine 🤞');
|
||||
assert.equal($('h1').html(), 'Page with alternative .mdwn extension');
|
||||
assert.equal($('p').html(), 'Hope this loads fine 🤞');
|
||||
});
|
||||
|
||||
it('Can load a markdown page with the `.mkdn` extension', async () => {
|
||||
const html = await fixture.readFile('/dot-mkdn-page/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').html(), 'Page with alternative .mkdn extension');
|
||||
assert.strictEqual($('p').html(), 'Hope this loads fine 🤞');
|
||||
assert.equal($('h1').html(), 'Page with alternative .mkdn extension');
|
||||
assert.equal($('p').html(), 'Hope this loads fine 🤞');
|
||||
});
|
||||
|
||||
it('Can load a markdown page with the `.mdown` extension', async () => {
|
||||
const html = await fixture.readFile('/dot-mdown-page/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').html(), 'Page with alternative .mdown extension');
|
||||
assert.strictEqual($('p').html(), 'Hope this loads fine 🤞');
|
||||
assert.equal($('h1').html(), 'Page with alternative .mdown extension');
|
||||
assert.equal($('p').html(), 'Hope this loads fine 🤞');
|
||||
});
|
||||
|
||||
it('Can load a markdown page with the `.mkd` extension', async () => {
|
||||
const html = await fixture.readFile('/dot-mkd-page/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
assert.strictEqual($('h1').html(), 'Page with alternative .mkd extension');
|
||||
assert.strictEqual($('p').html(), 'Hope this loads fine 🤞');
|
||||
assert.equal($('h1').html(), 'Page with alternative .mkd extension');
|
||||
assert.equal($('p').html(), 'Hope this loads fine 🤞');
|
||||
});
|
||||
|
||||
it('Can load a simple markdown page with Astro', async () => {
|
||||
const html = await fixture.readFile('/post/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('p').first().text(), 'Hello world!');
|
||||
assert.strictEqual($('#first').text(), 'Some content');
|
||||
assert.strictEqual($('#interesting-topic').text(), 'Interesting Topic');
|
||||
assert.equal($('p').first().text(), 'Hello world!');
|
||||
assert.equal($('#first').text(), 'Some content');
|
||||
assert.equal($('#interesting-topic').text(), 'Interesting Topic');
|
||||
});
|
||||
|
||||
it('Can load a realworld markdown page with Astro', async () => {
|
||||
const html = await fixture.readFile('/realworld/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
assert.strictEqual($('pre').length, 7);
|
||||
assert.equal($('pre').length, 7);
|
||||
});
|
||||
|
||||
it('Does not unescape entities', async () => {
|
||||
|
|
|
@ -28,6 +28,6 @@ describe('Markdown pages in SSR', () => {
|
|||
it('Renders markdown pages correctly', async () => {
|
||||
const html = await fetchHTML('/post');
|
||||
const $ = cheerioLoad(html);
|
||||
assert.strictEqual($('#subheading').text(), 'Subheading');
|
||||
assert.equal($('#subheading').text(), 'Subheading');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,67 +7,67 @@ describe('context', () => {
|
|||
const ctx = await getContext([]);
|
||||
assert.ok(!ctx.projectName);
|
||||
assert.ok(!ctx.template);
|
||||
assert.deepStrictEqual(ctx.skipHouston, os.platform() === 'win32');
|
||||
assert.deepEqual(ctx.skipHouston, os.platform() === 'win32');
|
||||
assert.ok(!ctx.dryRun);
|
||||
});
|
||||
|
||||
it('project name', async () => {
|
||||
const ctx = await getContext(['foobar']);
|
||||
assert.deepStrictEqual(ctx.projectName, 'foobar');
|
||||
assert.deepEqual(ctx.projectName, 'foobar');
|
||||
});
|
||||
|
||||
it('template', async () => {
|
||||
const ctx = await getContext(['--template', 'minimal']);
|
||||
assert.deepStrictEqual(ctx.template, 'minimal');
|
||||
assert.deepEqual(ctx.template, 'minimal');
|
||||
});
|
||||
|
||||
it('skip houston (explicit)', async () => {
|
||||
const ctx = await getContext(['--skip-houston']);
|
||||
assert.deepStrictEqual(ctx.skipHouston, true);
|
||||
assert.deepEqual(ctx.skipHouston, true);
|
||||
});
|
||||
|
||||
it('skip houston (yes)', async () => {
|
||||
const ctx = await getContext(['-y']);
|
||||
assert.deepStrictEqual(ctx.skipHouston, true);
|
||||
assert.deepEqual(ctx.skipHouston, true);
|
||||
});
|
||||
|
||||
it('skip houston (no)', async () => {
|
||||
const ctx = await getContext(['-n']);
|
||||
assert.deepStrictEqual(ctx.skipHouston, true);
|
||||
assert.deepEqual(ctx.skipHouston, true);
|
||||
});
|
||||
|
||||
it('skip houston (install)', async () => {
|
||||
const ctx = await getContext(['--install']);
|
||||
assert.deepStrictEqual(ctx.skipHouston, true);
|
||||
assert.deepEqual(ctx.skipHouston, true);
|
||||
});
|
||||
|
||||
it('dry run', async () => {
|
||||
const ctx = await getContext(['--dry-run']);
|
||||
assert.deepStrictEqual(ctx.dryRun, true);
|
||||
assert.deepEqual(ctx.dryRun, true);
|
||||
});
|
||||
|
||||
it('install', async () => {
|
||||
const ctx = await getContext(['--install']);
|
||||
assert.deepStrictEqual(ctx.install, true);
|
||||
assert.deepEqual(ctx.install, true);
|
||||
});
|
||||
|
||||
it('no install', async () => {
|
||||
const ctx = await getContext(['--no-install']);
|
||||
assert.deepStrictEqual(ctx.install, false);
|
||||
assert.deepEqual(ctx.install, false);
|
||||
});
|
||||
|
||||
it('git', async () => {
|
||||
const ctx = await getContext(['--git']);
|
||||
assert.deepStrictEqual(ctx.git, true);
|
||||
assert.deepEqual(ctx.git, true);
|
||||
});
|
||||
|
||||
it('no git', async () => {
|
||||
const ctx = await getContext(['--no-git']);
|
||||
assert.deepStrictEqual(ctx.git, false);
|
||||
assert.deepEqual(ctx.git, false);
|
||||
});
|
||||
|
||||
it('typescript', async () => {
|
||||
const ctx = await getContext(['--typescript', 'strict']);
|
||||
assert.deepStrictEqual(ctx.typescript, 'strict');
|
||||
assert.deepEqual(ctx.typescript, 'strict');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('test URIs beginning with a dot', () => {
|
|||
|
||||
const json = await res.json();
|
||||
|
||||
assert.notStrictEqual(json.applinks, {});
|
||||
assert.notEqual(json.applinks, {});
|
||||
});
|
||||
|
||||
it('cannot load a dot folder that is not a well-known URI', async () => {
|
||||
|
|
|
@ -5,12 +5,12 @@ import convert from '../vnode-children.js';
|
|||
describe('experimental react children', () => {
|
||||
it('has undefined as children for direct children', () => {
|
||||
const [imgVNode] = convert('<img src="abc"></img>');
|
||||
assert.deepStrictEqual(imgVNode.props.children, undefined);
|
||||
assert.deepEqual(imgVNode.props.children, undefined);
|
||||
});
|
||||
|
||||
it('has undefined as children for nested children', () => {
|
||||
const [divVNode] = convert('<div><img src="xyz"></img></div>');
|
||||
const [imgVNode] = divVNode.props.children;
|
||||
assert.deepStrictEqual(imgVNode.props.children, undefined);
|
||||
assert.deepEqual(imgVNode.props.children, undefined);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('collect images', async () => {
|
|||
'<p>Hello <img __ASTRO_IMAGE_="{"src":"./img.png","alt":"inline image url","index":0}"></p>'
|
||||
);
|
||||
|
||||
assert.deepStrictEqual(Array.from(imagePaths), ['./img.png']);
|
||||
assert.deepEqual(Array.from(imagePaths), ['./img.png']);
|
||||
});
|
||||
|
||||
it('should add image paths from definition', async () => {
|
||||
|
@ -37,6 +37,6 @@ describe('collect images', async () => {
|
|||
'<p>Hello <img __ASTRO_IMAGE_="{"src":"./img.webp","alt":"image ref","index":0}"></p>'
|
||||
);
|
||||
|
||||
assert.deepStrictEqual(Array.from(metadata.imagePaths), ['./img.webp']);
|
||||
assert.deepEqual(Array.from(metadata.imagePaths), ['./img.webp']);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue