diff options
Diffstat (limited to 'packages/astro/test/react-component.test.js')
-rw-r--r-- | packages/astro/test/react-component.test.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/astro/test/react-component.test.js b/packages/astro/test/react-component.test.js index bb67f3df2..749fc0c16 100644 --- a/packages/astro/test/react-component.test.js +++ b/packages/astro/test/react-component.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import cheerio from 'cheerio'; +import { load as cheerioLoad } from 'cheerio'; import { isWindows, loadFixture } from './test-utils.js'; let fixture; @@ -18,7 +18,7 @@ describe('React Components', () => { it('Can load React', async () => { const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html); + const $ = cheerioLoad(html); // test 1: basic component renders expect($('#react-static').text()).to.equal('Hello static!'); @@ -51,13 +51,13 @@ describe('React Components', () => { it('Can load Vue', async () => { const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html); + const $ = cheerioLoad(html); expect($('#vue-h2').text()).to.equal('Hasta la vista, baby'); }); it('Can use a pragma comment', async () => { const html = await fixture.readFile('/pragma-comment/index.html'); - const $ = cheerio.load(html); + const $ = cheerioLoad(html); // test 1: rendered the PragmaComment component expect($('.pragma-comment')).to.have.lengthOf(2); @@ -66,7 +66,7 @@ describe('React Components', () => { // TODO: is this still a relevant test? it.skip('Includes reactroot on hydrating components', async () => { const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html); + const $ = cheerioLoad(html); const div = $('#research'); @@ -76,6 +76,13 @@ describe('React Components', () => { // test 2: renders correctly expect(div.html()).to.equal('foo bar <!-- -->1'); }); + + it('Can load Suspense-using components', async () => { + const html = await fixture.readFile('/suspense/index.html'); + const $ = cheerioLoad(html); + expect($('#client #lazy')).to.have.lengthOf(1); + expect($('#server #lazy')).to.have.lengthOf(1); + }); }); if (isWindows) return; @@ -93,7 +100,7 @@ describe('React Components', () => { it('scripts proxy correctly', async () => { const html = await fixture.fetch('/').then((res) => res.text()); - const $ = cheerio.load(html); + const $ = cheerioLoad(html); for (const script of $('script').toArray()) { const { src } = script.attribs; |