From cfe7c2dae39eeee8a6c8328f6396402cf6785585 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Mon, 12 Feb 2024 12:15:10 +0100 Subject: [PATCH] fix: add test for gzipped fixtures (#1464) Test loading gzipped fixtures, particularly in browsers. Prevents regressions of https://github.com/ipfs/aegir/issues/1462 --- test/browser.spec.js | 5 +++++ test/fixtures.js | 5 +++++ test/fixtures/file.tar.gz | Bin 0 -> 10 bytes 3 files changed, 10 insertions(+) create mode 100644 test/fixtures/file.tar.gz diff --git a/test/browser.spec.js b/test/browser.spec.js index 50e8dbccd..df11dd1ad 100644 --- a/test/browser.spec.js +++ b/test/browser.spec.js @@ -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() diff --git a/test/fixtures.js b/test/fixtures.js index b49632ffb..8c0c15672 100644 --- a/test/fixtures.js +++ b/test/fixtures.js @@ -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') + }) }) diff --git a/test/fixtures/file.tar.gz b/test/fixtures/file.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2534dcbeb930aa87b8fbff77b9e5169df0569f69 GIT binary patch literal 10 Rcmb2|=HTcImJMRy1^^7@0ucZJ literal 0 HcmV?d00001