Skip to content

Commit

Permalink
add test coverage for SSR pages content type
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Aug 12, 2023
1 parent 7514286 commit 08069e2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ describe('Build Greenwood With: ', function() {
const response = await handler({
rawUrl: `http://localhost:8080/${name}/`
}, {});
const { statusCode, body } = response;
const { statusCode, body, headers } = response;
const dom = new JSDOM(body);
const cardTags = dom.window.document.querySelectorAll('body > app-card');
const headings = dom.window.document.querySelectorAll('body > h1');

expect(statusCode).to.be.equal(200);
expect(headers.get('content-type')).to.be.equal('text/html');
expect(cardTags.length).to.be.equal(count);
expect(headings.length).to.be.equal(1);
expect(headings[0].textContent).to.be.equal(`List of Artists: ${count}`);
Expand Down Expand Up @@ -208,12 +209,13 @@ describe('Build Greenwood With: ', function() {
const response = await handler({
rawUrl: `http://localhost:8080/${name}/`
}, {});
const { statusCode, body } = response;
const { statusCode, body, headers } = response;
const dom = new JSDOM(body);
const cardTags = dom.window.document.querySelectorAll('body > app-card');
const headings = dom.window.document.querySelectorAll('body > h1');

expect(statusCode).to.be.equal(200);
expect(headers.get('content-type')).to.be.equal('text/html');
expect(cardTags.length).to.be.equal(count);
expect(headings.length).to.be.equal(1);
expect(headings[0].textContent).to.be.equal(`List of Users: ${count}`);
Expand Down

0 comments on commit 08069e2

Please sign in to comment.