Skip to content

Commit

Permalink
handle windows path seperators in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Dec 24, 2024
1 parent 180f60d commit a776684
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ describe('Build Greenwood With: ', function() {
});

it('should have the expected <script> tag in the <head>', function() {
const src = jsFiles[0].replace(this.context.publicDir, '');
const src = jsFiles[0].replace(this.context.publicDir.replace(/\\/g, '/'), '');
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => tag.getAttribute('src') === src);

expect(scriptTags.length).to.be.equal(1);
});

it('should have the expected preload <script> tag in the <head>', function() {
const src = jsFiles[0].replace(this.context.publicDir, '');
const src = jsFiles[0].replace(this.context.publicDir.replace(/\\/g, '/'), '');
const scriptPreloadTags = Array.from(dom.window.document.querySelectorAll('head link[as="script"]'));

expect(scriptPreloadTags.length).to.be.equal(1);
Expand All @@ -110,15 +110,15 @@ describe('Build Greenwood With: ', function() {
});

it('should have the expected preload <link> tag in the <head>', function() {
const href = cssFiles[0].replace(this.context.publicDir, '');
const href = cssFiles[0].replace(this.context.publicDir.replace(/\\/g, '/'), '');
const linkPreloadTags = Array.from(dom.window.document.querySelectorAll('head link[as="style"]'));

expect(linkPreloadTags.length).to.be.equal(1);
expect(linkPreloadTags[0].getAttribute('href')).to.be.equal(href);
});

it('should have the expected <link> tag href for theme.css', function() {
const href = cssFiles[0].replace(this.context.publicDir, '');
const href = cssFiles[0].replace(this.context.publicDir.replace(/\\/g, '/'), '');
const linkTags = Array.from(dom.window.document.querySelectorAll('head link[rel="stylesheet"]')).filter(tag => tag.getAttribute('href') === href);

expect(linkTags.length).to.be.equal(1);
Expand Down

0 comments on commit a776684

Please sign in to comment.