Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
foxxsupertest
Advanced tools
Readme
HTTP assertions adopted from Supertest for ArangoDB Foxx
You will need to have at least ArangoDb 2.6 installed.
npm install foxxsupertest
You will need to pass the following option when you first initialize the module:
applicationContext
: This is the default global application context variable within your Foxx app.serverAddress
: Your ArangoDB server address, e.g: http://localhost:8529
.baseURL
: Your database mounting point (not the Foxx mounting point), e.g: /_db/_system
.FoxxSupertest works well with Mocha shipped-in with ArangoDB 2.6. The following examples demonstrate how it works as it differ a little bit from the original Supertest:
let request = require("foxxsupertest")(applicationContext, "http://localhost:8529");
describe("GET /test", function(){
it("should responds with 200", function(done){
request
.get('/test')
.expect(200)
.end(function(err, res){
if(err) throw err;
done();
});
});
}
As the original SuperTest, you can add many expect
with different types:
let request = require("foxxsupertest")(applicationContext, "http://localhost:8529");
describe("GET /test", function(){
it("should responds with json and 200", function(done){
request
.get('/test')
.expect('Content-Type', /json/)
.expect(200)
.end(function(err, res){
if(err) throw err;
done();
});
});
}
If you want to add headers and content to your request, you will need to add them to the request options since FoxxSupertest uses the request module shipped with ArangoDB to simulate the http requests:
let request = require("foxxsupertest")(applicationContext, "http://localhost:8529");
describe("GET /users", function(){
it("should responds with json and 200", function(done){
request
.post('/test',{
auth: {
username : "test",
password : "test"
},
body: {
content: "content to post"
},
json: true
})
.expect('Content-Type', /json/)
.expect(200)
.end(function(err, res){
if(err) throw err;
done();
});
});
}
FoxxSupertest uses the similar API which Supertest uses:
Assert response status
code.
Assert response status
code and body
.
Assert response body
text with a string, regular expression, or
parsed body object.
Assert header field
value
with a string or regular expression.
Perform the request and invoke fn(err, res)
.
As we mentioend before, this module was adopted from Supertest, hence we resued some of the original source code to work with this module
Omar A. Al-Safi (omarsmak@gmail.com, omar@fedger.io)
MIT
FAQs
HTTP assertions adopted from Supertest for ArangoDB Foxx
The npm package foxxsupertest receives a total of 2 weekly downloads. As such, foxxsupertest popularity was classified as not popular.
We found that foxxsupertest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.