From 80216332585fbea5ba658133ba94aa0d6148f18f Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Mon, 9 Sep 2024 05:04:37 +0530 Subject: [PATCH] fix: Relax Content-Type Checks in Integration Tests When checking response `Content-Type` during integration tests, relaxed all media-type values to regex. --- test/integration/formats-test.js | 4 ++-- test/integration/http-test.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/integration/formats-test.js b/test/integration/formats-test.js index 4a8ef11b..e3146396 100644 --- a/test/integration/formats-test.js +++ b/test/integration/formats-test.js @@ -112,13 +112,13 @@ describe('formats', function () { it('Accept text/plain', function (done) { server.get('/put-input.txt') .set('accept', 'text/plain') - .expect('Content-type', 'text/plain') + .expect('Content-type', /text\/plain/) .expect(200, done) }) it('Accept text/turtle', function (done) { server.get('/put-input.txt') .set('accept', 'text/turtle') - .expect('Content-type', 'text/plain; charset=utf-8') + .expect('Content-type', /text\/plain/) .expect(406, done) }) }) diff --git a/test/integration/http-test.js b/test/integration/http-test.js index 58c9f714..81b7be3f 100644 --- a/test/integration/http-test.js +++ b/test/integration/http-test.js @@ -349,7 +349,7 @@ describe('HTTP APIs', function () { it('should return resource link for files', function (done) { server.get('/hello.html') .expect('Link', /; rel="type"/) - .expect('Content-Type', 'text/html') + .expect('Content-Type', /text\/html/) .expect(200, done) }) it('should have glob support', function (done) { @@ -460,30 +460,30 @@ describe('HTTP APIs', function () { describe('HEAD API', function () { it('should return content-type application/octet-stream by default', function (done) { server.head('/sampleContainer/blank') - .expect('Content-Type', 'application/octet-stream; charset=utf-8') + .expect('Content-Type', /application\/octet-stream/) .end(done) }) it('should return content-type text/turtle for container', function (done) { server.head('/sampleContainer2/') - .expect('Content-Type', 'text/turtle; charset=utf-8') + .expect('Content-Type', /text\/turtle/) .end(done) }) it('should have set content-type for turtle files', function (done) { server.head('/sampleContainer2/example1.ttl') - .expect('Content-Type', 'text/turtle; charset=utf-8') + .expect('Content-Type', /text\/turtle/) .end(done) }) it('should have set content-type for implicit turtle files', function (done) { server.head('/sampleContainer/example4') - .expect('Content-Type', 'text/turtle; charset=utf-8') + .expect('Content-Type', /text\/turtle/) .end(done) }) it('should have set content-type for image files', function (done) { server.head('/sampleContainer/solid.png') - .expect('Content-Type', 'image/png; charset=utf-8') + .expect('Content-Type', /image\/png/) .end(done) }) it('should have Access-Control-Allow-Origin as Origin', function (done) { @@ -517,7 +517,7 @@ describe('HTTP APIs', function () { it('should have set Content-Type as text/turtle for Container', function (done) { server.head('/sampleContainer2/') - .expect('Content-Type', 'text/turtle; charset=utf-8') + .expect('Content-Type', /text\/turtle/) .expect(200, done) }) it('should have set Link as Container/BasicContainer',