Skip to content

Commit

Permalink
fix: Relax Content-Type Checks in Integration Tests
Browse files Browse the repository at this point in the history
When checking response `Content-Type` during integration tests, relaxed all media-type values to regex.
  • Loading branch information
CxRes committed Sep 8, 2024
1 parent fd99081 commit 8021633
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test/integration/formats-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
Expand Down
14 changes: 7 additions & 7 deletions test/integration/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ describe('HTTP APIs', function () {
it('should return resource link for files', function (done) {
server.get('/hello.html')
.expect('Link', /<http:\/\/www.w3.org\/ns\/ldp#Resource>; rel="type"/)
.expect('Content-Type', 'text/html')
.expect('Content-Type', /text\/html/)
.expect(200, done)
})
it('should have glob support', function (done) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 8021633

Please sign in to comment.