Skip to content

Commit 5ff288f

Browse files
authored
chore: Change strictEqual to equal (#10140)
1 parent 7bdcfb7 commit 5ff288f

22 files changed

+152
-158
lines changed

packages/astro-rss/test/pagesGlobToRssItems.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('pagesGlobToRssItems', () => {
4747
},
4848
];
4949

50-
assert.deepStrictEqual(
50+
assert.deepEqual(
5151
items.sort((a, b) => a.pubDate - b.pubDate),
5252
expected
5353
);

packages/astro-rss/test/rss.test.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function assertXmlDeepEqual(a, b) {
3636
const parsedA = parseXmlString(a);
3737
const parsedB = parseXmlString(b);
3838

39-
assert.strictEqual(parsedA.err, null);
40-
assert.strictEqual(parsedB.err, null);
41-
assert.deepStrictEqual(parsedA.result, parsedB.result);
39+
assert.equal(parsedA.err, null);
40+
assert.equal(parsedB.err, null);
41+
assert.deepEqual(parsedA.result, parsedB.result);
4242
}
4343

4444
describe('rss', () => {
@@ -58,7 +58,7 @@ describe('rss', () => {
5858
assertXmlDeepEqual(str, validXmlResult);
5959

6060
const contentType = response.headers.get('Content-Type');
61-
assert.strictEqual(contentType, 'application/xml');
61+
assert.equal(contentType, 'application/xml');
6262
});
6363

6464
it('should be the same string as getRssString', async () => {
@@ -73,7 +73,7 @@ describe('rss', () => {
7373
const str1 = await response.text();
7474
const str2 = await getRssString(options);
7575

76-
assert.strictEqual(str1, str2);
76+
assert.equal(str1, str2);
7777
});
7878
});
7979

@@ -223,8 +223,8 @@ describe('getRssString', () => {
223223
link: phpFeedItem.link,
224224
});
225225

226-
assert.strictEqual(res.success, false);
227-
assert.strictEqual(res.error.issues[0].path[0], 'pubDate');
226+
assert.equal(res.success, false);
227+
assert.equal(res.error.issues[0].path[0], 'pubDate');
228228
});
229229

230230
it('should be extendable', () => {
@@ -236,7 +236,7 @@ describe('getRssString', () => {
236236
} catch (e) {
237237
error = e.message;
238238
}
239-
assert.strictEqual(error, null);
239+
assert.equal(error, null);
240240
});
241241

242242
it('should not fail when an enclosure has a length of 0', async () => {
@@ -264,6 +264,6 @@ describe('getRssString', () => {
264264
error = e.message;
265265
}
266266

267-
assert.strictEqual(error, null);
267+
assert.equal(error, null);
268268
});
269269
});

packages/astro/test/astro-basic.nodetest.js

+14-17
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('Astro basic build', () => {
9797
const $ = cheerio.load(html);
9898

9999
// will be 1 if element rendered correctly
100-
assert.strictEqual($('#one').length, 1);
100+
assert.equal($('#one').length, 1);
101101
});
102102

103103
it('supports special chars in filename', async () => {
@@ -108,45 +108,42 @@ describe('Astro basic build', () => {
108108
it('renders the components top-down', async () => {
109109
const html = await fixture.readFile('/order/index.html');
110110
const $ = cheerio.load(html);
111-
assert.strictEqual($('#rendered-order').text(), 'Rendered order: A, B');
111+
assert.equal($('#rendered-order').text(), 'Rendered order: A, B');
112112
});
113113

114114
it('renders markdown in utf-8 by default', async () => {
115115
const html = await fixture.readFile('/chinese-encoding-md/index.html');
116116
const $ = cheerio.load(html);
117-
assert.strictEqual($('h1').text(), '我的第一篇博客文章');
117+
assert.equal($('h1').text(), '我的第一篇博客文章');
118118
});
119119

120120
it('renders MDX in utf-8 by default', async () => {
121121
const html = await fixture.readFile('/chinese-encoding-mdx/index.html');
122122
const $ = cheerio.load(html);
123-
assert.strictEqual($('h1').text(), '我的第一篇博客文章');
123+
assert.equal($('h1').text(), '我的第一篇博客文章');
124124
});
125125

126126
it('Supports void elements whose name is a string (#2062)', async () => {
127127
const html = await fixture.readFile('/input/index.html');
128128
const $ = cheerio.load(html);
129129

130130
// <Input />
131-
assert.strictEqual($('body > :nth-child(1)').prop('outerHTML'), '<input>');
131+
assert.equal($('body > :nth-child(1)').prop('outerHTML'), '<input>');
132132

133133
// <Input type="password" />
134-
assert.strictEqual($('body > :nth-child(2)').prop('outerHTML'), '<input type="password">');
134+
assert.equal($('body > :nth-child(2)').prop('outerHTML'), '<input type="password">');
135135

136136
// <Input type="text" />
137-
assert.strictEqual($('body > :nth-child(3)').prop('outerHTML'), '<input type="text">');
137+
assert.equal($('body > :nth-child(3)').prop('outerHTML'), '<input type="text">');
138138

139139
// <Input type="select"><option>option</option></Input>
140-
assert.strictEqual(
140+
assert.equal(
141141
$('body > :nth-child(4)').prop('outerHTML'),
142142
'<select><option>option</option></select>'
143143
);
144144

145145
// <Input type="textarea">textarea</Input>
146-
assert.strictEqual(
147-
$('body > :nth-child(5)').prop('outerHTML'),
148-
'<textarea>textarea</textarea>'
149-
);
146+
assert.equal($('body > :nth-child(5)').prop('outerHTML'), '<textarea>textarea</textarea>');
150147
});
151148

152149
it('Generates pages that end with .mjs', async () => {
@@ -159,18 +156,18 @@ describe('Astro basic build', () => {
159156
it('allows file:// urls as module specifiers', async () => {
160157
const html = await fixture.readFile('/fileurl/index.html');
161158
const $ = cheerio.load(html);
162-
assert.strictEqual($('h1').text(), 'WORKS');
159+
assert.equal($('h1').text(), 'WORKS');
163160
});
164161

165162
describe('preview', () => {
166163
it('returns 200 for valid URLs', async () => {
167164
const result = await fixture.fetch('/');
168-
assert.strictEqual(result.status, 200);
165+
assert.equal(result.status, 200);
169166
});
170167

171168
it('returns 404 for invalid URLs', async () => {
172169
const result = await fixture.fetch('/bad-url');
173-
assert.strictEqual(result.status, 404);
170+
assert.equal(result.status, 404);
174171
});
175172
});
176173
});
@@ -193,7 +190,7 @@ describe('Astro basic development', () => {
193190

194191
it('Renders markdown in utf-8 by default', async () => {
195192
const res = await fixture.fetch('/chinese-encoding-md');
196-
assert.strictEqual(res.status, 200);
193+
assert.equal(res.status, 200);
197194
const html = await res.text();
198195
const $ = cheerio.load(html);
199196
assert.equal($('h1').text(), '我的第一篇博客文章');
@@ -205,7 +202,7 @@ describe('Astro basic development', () => {
205202

206203
it('Renders MDX in utf-8 by default', async () => {
207204
const res = await fixture.fetch('/chinese-encoding-mdx');
208-
assert.strictEqual(res.status, 200);
205+
assert.equal(res.status, 200);
209206
const html = await res.text();
210207
const $ = cheerio.load(html);
211208
assert.equal($('h1').text(), '我的第一篇博客文章');

packages/astro/test/astro-children.nodetest.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ describe('Component children', () => {
1717

1818
// test 1: Can pass text to Preact components
1919
const $preact = $('#preact');
20-
assert.strictEqual($preact.text().trim(), 'Hello world');
20+
assert.equal($preact.text().trim(), 'Hello world');
2121

2222
// test 2: Can pass text to Vue components
2323
const $vue = $('#vue');
24-
assert.strictEqual($vue.text().trim(), 'Hello world');
24+
assert.equal($vue.text().trim(), 'Hello world');
2525

2626
// test 3: Can pass text to Svelte components
2727
const $svelte = $('#svelte');
28-
assert.strictEqual($svelte.text().trim(), 'Hello world');
28+
assert.equal($svelte.text().trim(), 'Hello world');
2929
});
3030

3131
it('Passes markup children to framework components', async () => {
@@ -34,15 +34,15 @@ describe('Component children', () => {
3434

3535
// test 1: Can pass markup to Preact components
3636
const $preact = $('#preact h1');
37-
assert.strictEqual($preact.text().trim(), 'Hello world');
37+
assert.equal($preact.text().trim(), 'Hello world');
3838

3939
// test 2: Can pass markup to Vue components
4040
const $vue = $('#vue h1');
41-
assert.strictEqual($vue.text().trim(), 'Hello world');
41+
assert.equal($vue.text().trim(), 'Hello world');
4242

4343
// test 3: Can pass markup to Svelte components
4444
const $svelte = $('#svelte h1');
45-
assert.strictEqual($svelte.text().trim(), 'Hello world');
45+
assert.equal($svelte.text().trim(), 'Hello world');
4646
});
4747

4848
it('Passes multiple children to framework components', async () => {
@@ -51,48 +51,48 @@ describe('Component children', () => {
5151

5252
// test 1: Can pass multiple children to Preact components
5353
const $preact = $('#preact');
54-
assert.strictEqual($preact.children().length, 2);
55-
assert.strictEqual($preact.children(':first-child').text().trim(), 'Hello world');
56-
assert.strictEqual($preact.children(':last-child').text().trim(), 'Goodbye world');
54+
assert.equal($preact.children().length, 2);
55+
assert.equal($preact.children(':first-child').text().trim(), 'Hello world');
56+
assert.equal($preact.children(':last-child').text().trim(), 'Goodbye world');
5757

5858
// test 2: Can pass multiple children to Vue components
5959
const $vue = $('#vue');
60-
assert.strictEqual($vue.children().length, 2);
61-
assert.strictEqual($vue.children(':first-child').text().trim(), 'Hello world');
62-
assert.strictEqual($vue.children(':last-child').text().trim(), 'Goodbye world');
60+
assert.equal($vue.children().length, 2);
61+
assert.equal($vue.children(':first-child').text().trim(), 'Hello world');
62+
assert.equal($vue.children(':last-child').text().trim(), 'Goodbye world');
6363

6464
// test 3: Can pass multiple children to Svelte components
6565
const $svelte = $('#svelte');
66-
assert.strictEqual($svelte.children().length, 2);
67-
assert.strictEqual($svelte.children(':first-child').text().trim(), 'Hello world');
68-
assert.strictEqual($svelte.children(':last-child').text().trim(), 'Goodbye world');
66+
assert.equal($svelte.children().length, 2);
67+
assert.equal($svelte.children(':first-child').text().trim(), 'Hello world');
68+
assert.equal($svelte.children(':last-child').text().trim(), 'Goodbye world');
6969
});
7070

7171
it('Renders a template when children are not rendered for client components', async () => {
7272
const html = await fixture.readFile('/no-render/index.html');
7373
const $ = cheerio.load(html);
7474

7575
// test 1: If SSR only, no children are rendered.
76-
assert.strictEqual($('#ssr-only').children().length, 0);
76+
assert.equal($('#ssr-only').children().length, 0);
7777

7878
// test 2: If client, and no children are rendered, a template is.
79-
assert.strictEqual(
79+
assert.equal(
8080
$('#client').parent().children().length,
8181
2,
8282
'rendered the client component and a template'
8383
);
84-
assert.strictEqual(
84+
assert.equal(
8585
$('#client').parent().find('template[data-astro-template]').length,
8686
1,
8787
'Found 1 template'
8888
);
8989

9090
// test 3: If client, and children are rendered, no template is.
91-
assert.strictEqual($('#client-render').parent().children().length, 1);
92-
assert.strictEqual($('#client-render').parent().find('template').length, 0);
91+
assert.equal($('#client-render').parent().children().length, 1);
92+
assert.equal($('#client-render').parent().find('template').length, 0);
9393

9494
// test 4: If client and no children are provided, no template is.
95-
assert.strictEqual($('#client-no-children').parent().children().length, 1);
96-
assert.strictEqual($('#client-no-children').parent().find('template').length, 0);
95+
assert.equal($('#client-no-children').parent().children().length, 1);
96+
assert.equal($('#client-no-children').parent().find('template').length, 0);
9797
});
9898
});

packages/astro/test/astro-markdown-frontmatter-injection.nodetest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Astro Markdown - frontmatter injection', () => {
2828
);
2929
assert.ok(readingTimes.length > 0);
3030
for (let readingTime of readingTimes) {
31-
assert.notStrictEqual(readingTime, null);
31+
assert.notEqual(readingTime, null);
3232
assert.match(readingTime.text, /^\d+ min read/);
3333
}
3434
});

packages/astro/test/astro-markdown-plugins.nodetest.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Astro Markdown plugins', () => {
4646
const $ = cheerio.load(html);
4747

4848
// test 1: Added a TOC
49-
assert.strictEqual($('.toc').length, 1);
49+
assert.equal($('.toc').length, 1);
5050

5151
// test 2: Added .title to h1
5252
assert.ok($('#hello-world').hasClass('title'));
@@ -56,11 +56,11 @@ describe('Astro Markdown plugins', () => {
5656
it('Still applies default plugins when user plugins are provided', async () => {
5757
const gfmHtml = await fixture.readFile('/with-gfm/index.html');
5858
const $1 = cheerio.load(gfmHtml);
59-
assert.strictEqual($1('a[href="https://example.com"]').length, 1);
59+
assert.equal($1('a[href="https://example.com"]').length, 1);
6060

6161
const smartypantsHtml = await fixture.readFile('/with-smartypants/index.html');
6262
const $2 = cheerio.load(smartypantsHtml);
63-
assert.strictEqual($2('p').html(), '“Smartypants” is — awesome');
63+
assert.equal($2('p').html(), '“Smartypants” is — awesome');
6464

6565
testRemark(gfmHtml);
6666
testRehype(gfmHtml, '#github-flavored-markdown-test');
@@ -71,7 +71,7 @@ describe('Astro Markdown plugins', () => {
7171
const $ = cheerio.load(html);
7272

7373
// test 1: GFM autolink applied correctly
74-
assert.strictEqual($('a[href="https://example.com"]').length, 1);
74+
assert.equal($('a[href="https://example.com"]').length, 1);
7575

7676
testRemark(html);
7777
testRehype(html, '#github-flavored-markdown-test');
@@ -82,7 +82,7 @@ describe('Astro Markdown plugins', () => {
8282
const $ = cheerio.load(html);
8383

8484
// test 1: smartypants applied correctly
85-
assert.strictEqual($('p').html(), '“Smartypants” is — awesome');
85+
assert.equal($('p').html(), '“Smartypants” is — awesome');
8686

8787
testRemark(html);
8888
testRehype(html, '#smartypants-test');
@@ -99,7 +99,7 @@ describe('Astro Markdown plugins', () => {
9999
const html = await fixture.readFile('/with-gfm/index.html');
100100
const $ = cheerio.load(html);
101101

102-
assert.strictEqual($('a[href="https://example.com"]').length, 0);
102+
assert.equal($('a[href="https://example.com"]').length, 0);
103103

104104
testRemark(html);
105105
testRehype(html, '#github-flavored-markdown-test');
@@ -115,7 +115,7 @@ describe('Astro Markdown plugins', () => {
115115
const html = await fixture.readFile('/with-smartypants/index.html');
116116
const $ = cheerio.load(html);
117117

118-
assert.strictEqual($('p').html(), '"Smartypants" is -- awesome');
118+
assert.equal($('p').html(), '"Smartypants" is -- awesome');
119119

120120
testRemark(html);
121121
testRehype(html, '#smartypants-test');
@@ -124,7 +124,7 @@ describe('Astro Markdown plugins', () => {
124124

125125
function testRehype(html, headingId) {
126126
const $ = cheerio.load(html);
127-
assert.strictEqual($(headingId).length, 1);
127+
assert.equal($(headingId).length, 1);
128128
assert.ok($(headingId).hasClass('title'));
129129
}
130130

packages/astro/test/astro-markdown-remarkRehype.nodetest.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ describe('Astro Markdown without remark-rehype config', () => {
1515
it('Renders footnotes with default English labels', async () => {
1616
const html = await fixture.readFile('/index.html');
1717
const $ = cheerio.load(html);
18-
assert.strictEqual($('#footnote-label').text(), 'Footnotes');
19-
assert.strictEqual(
20-
$('.data-footnote-backref').first().attr('aria-label'),
21-
'Back to reference 1'
22-
);
18+
assert.equal($('#footnote-label').text(), 'Footnotes');
19+
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Back to reference 1');
2320
});
2421
});
2522

@@ -41,7 +38,7 @@ describe('Astro Markdown with remark-rehype config', () => {
4138
it('Renders footnotes with values from the configuration', async () => {
4239
const html = await fixture.readFile('/index.html');
4340
const $ = cheerio.load(html);
44-
assert.strictEqual($('#footnote-label').text(), 'Catatan kaki');
45-
assert.strictEqual($('.data-footnote-backref').first().attr('aria-label'), 'Kembali ke konten');
41+
assert.equal($('#footnote-label').text(), 'Catatan kaki');
42+
assert.equal($('.data-footnote-backref').first().attr('aria-label'), 'Kembali ke konten');
4643
});
4744
});

0 commit comments

Comments
 (0)