Skip to content

Commit

Permalink
fix: add test for gzipped fixtures (#1464)
Browse files Browse the repository at this point in the history
Test loading gzipped fixtures, particularly in browsers.

Prevents regressions of #1462
  • Loading branch information
achingbrain authored Feb 12, 2024
1 parent 70c4c17 commit cfe7c2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ describe('browser', () => {
expect(uint8ArrayToString(myFixture)).to.be.eql('Hello Fixture\n')
})

it('should load tar.gz fixures', () => {
const myFixture = loadFixture('test/fixtures/file.tar.gz')
expect(uint8ArrayToString(myFixture, 'base64')).to.equal('H4sICIlTHVIACw')
})

it('non existing fixtures', () => {
expect(() => loadFixture('/test/fixtures/asdalkdjaskldjatest.txt'))
.to.throw()
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ describe('fixtures', () => {
const myFixture = loadFixture(path.join('test', 'fixtures', 'test.txt'))
expect(uint8ArrayToString(myFixture).trim()).to.be.eql('Hello Fixture')
})

it('should load tar.gz fixures', () => {
const myFixture = loadFixture(path.join('test', 'fixtures', 'file.tar.gz'))
expect(uint8ArrayToString(myFixture, 'base64')).to.equal('H4sICIlTHVIACw')
})
})
Binary file added test/fixtures/file.tar.gz
Binary file not shown.

0 comments on commit cfe7c2d

Please sign in to comment.