Skip to content

Commit

Permalink
Updated dependencies and test code for new chai version (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec authored Jun 19, 2023
1 parent 014a107 commit da5cd13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"devDependencies": {
"chai": "^4.3.7",
"chai-http": "^4.3.0",
"eslint": "^8.41.0",
"chai-http": "^4.4.0",
"eslint": "^8.43.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0"
},
Expand Down
2 changes: 2 additions & 0 deletions tests/auto_extdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ describe('API : EXTDATA', function(){ // eslint-disable-line no-undef

chai.request(app)
.get(uri)
.set('user-agent', '')
.set('content-type', 'application/octet-stream')
.set('user-agent', ua)
.set('accept-encoding', 'identity') // Chai send gzip encoding as default, thus we set 'identity'
Expand All @@ -194,6 +195,7 @@ describe('API : EXTDATA', function(){ // eslint-disable-line no-undef

chai.request(app)
.get(uri)
.set('user-agent', '')
.set('content-type', 'application/octet-stream')
.set('accept-encoding', 'identity') // Chai send gzip encoding as default, thus we set 'identity'
.end(function(err, res){
Expand Down
27 changes: 15 additions & 12 deletions tests/auto_userdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
expect(res.files).to.be.an('object'); // response has some files from 'multipart/mixed'
expect(res.files[null]).to.be.an('object'); // check only first(null) position( [TODO] checking another )
expect(res.files[null].size).to.be.a('number'); // file has size member
expect(res.files[null].path).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].name).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].type).to.be.an('string').to.not.empty; // file is set 'content-type'
expect(res.files[null].filepath).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].originalFilename).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].mimetype).to.be.an('string').to.not.empty; // file is set 'content-type'
done();
});
});
Expand All @@ -109,9 +109,9 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
expect(res.files).to.be.an('object'); // response has some files from 'multipart/mixed'
expect(res.files[null]).to.be.an('object'); // check only first(null) position( [TODO] checking another )
expect(res.files[null].size).to.be.a('number'); // file has size member
expect(res.files[null].path).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].name).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].type).to.be.an('string').to.not.empty; // file is set 'content-type'
expect(res.files[null].filepath).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].originalFilename).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].mimetype).to.be.an('string').to.not.empty; // file is set 'content-type'
done();
});
});
Expand All @@ -135,9 +135,9 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
expect(res.files).to.be.an('object'); // response has some files from 'multipart/mixed'
expect(res.files[null]).to.be.an('object'); // check only first(null) position( [TODO] checking another )
expect(res.files[null].size).to.be.a('number'); // file has size member
expect(res.files[null].path).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].name).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].type).to.be.an('string').to.not.empty; // file is set 'content-type'
expect(res.files[null].filepath).to.be.an('string').to.not.empty; // file has temporary path
expect(res.files[null].originalFilename).to.be.an('string').to.not.empty; // file has real name
expect(res.files[null].mimetype).to.be.an('string').to.not.empty; // file is set 'content-type'
done();
});
});
Expand All @@ -148,6 +148,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef

chai.request(app)
.get(uri)
.set('user-agent', '')
.set('content-type', 'application/octet-stream')
.set('accept-encoding', 'identity') // Chai send gzip encoding as default, thus we set 'identity'
.end(function(err, res){
Expand All @@ -167,6 +168,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef

chai.request(app)
.get(uri)
.set('user-agent', '')
.set('accept-encoding', '') // Chai send gzip encoding as default, thus we set ''
.end(function(err, res){
expect(res).to.have.status(400);
Expand All @@ -191,7 +193,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
.end(function(err, res){
expect(res).to.have.status(200);
expect(res).to.be.an('object');
expect(res.body).to.be.an('object').to.be.empty; // body is empty because it must be 'application/json'
expect(res.body).be.instanceof(Buffer); // body is empty because it must be 'application/json'
expect(res.text).to.be.a('undefined'); // text is empty because it must be 'text/plain'
expect(res.files).to.be.a('undefined'); // files is empty because it must be 'text/plain'
expect(res.header).to.be.an('object'); // check response header
Expand Down Expand Up @@ -219,7 +221,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
.end(function(err, res){
expect(res).to.have.status(200);
expect(res).to.be.an('object');
expect(res.body).to.be.an('object').to.be.empty; // body is empty because it must be 'application/json'
expect(res.body).be.instanceof(Buffer); // body is empty because it must be 'application/json'
expect(res.text).to.be.a('undefined'); // text is empty because it must be 'text/plain'
expect(res.files).to.be.a('undefined'); // files is empty because it must be 'text/plain'
expect(res.header).to.be.an('object'); // check response header
Expand All @@ -246,7 +248,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef
.end(function(err, res){
expect(res).to.have.status(200);
expect(res).to.be.an('object');
expect(res.body).to.be.an('object').to.be.empty; // body is empty because it must be 'application/json'
expect(res.body).be.instanceof(Buffer); // body is empty because it must be 'application/json'
expect(res.text).to.be.a('undefined'); // text is empty because it must be 'text/plain'
expect(res.files).to.be.a('undefined'); // files is empty because it must be 'text/plain'
expect(res.header).to.be.an('object'); // check response header
Expand All @@ -265,6 +267,7 @@ describe('API : USERDATA', function(){ // eslint-disable-line no-undef

chai.request(app)
.get(uri)
.set('user-agent', '')
.set('content-type', 'application/octet-stream')
.set('accept-encoding', 'gzip')
.end(function(err, res){
Expand Down

0 comments on commit da5cd13

Please sign in to comment.