Testing Endpoints
See original GitHub issueAs asked on the Gitter channel, it would be nice to provide a meaning for testing Finch endpoints (routers).
The idea I’m suggesting relies on types we expose from endpoints (that’s a very good excuse to have them) and allows the users to treat endpoints as a regular functions so they could be easily tested.
Here is the example.
case class User(name: String)
val getUser: Endpoint[User] = get("users" / long) { id: Long =>
User(id.toString)
}
// test
getUser.lift(100) shouldBe User("100")
The lift
(or whatever) method lifts the endpoint to a function (A, B, ..., Z) => Out
, where (A, B, ..., Z)
are values extracted fromt the request by endpoint and Out
is a returned value.
Not sure if it’s even possible, but I’d like to move Finch (make required chnages) towards the direction it will be possible.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:5 (3 by maintainers)
Top Results From Across the Web
A step-by-step intro to end-point testing
You can use Supertest to test endpoints. First, you need to install Supertest. ... Before you can test endpoints, you need to setup...
Read more >What is API Testing? How to Test API Endpoints ...
API testing is a type of software testing that involves testing application programming interfaces (APIs) directly and as part of integration ...
Read more >How to test API Endpoint?
Test API endpoints by making API requests directly from your browser. Check server status codes, response times, and sizes. Use ReqBin API ...
Read more >You should Unit Test your API endpoints, it's easy!
An uncomplicated guide to unit test RESTful API endpoints in Go ... APIs in Go beyond Hello World” we'll look at an approach...
Read more >Testing a REST API: Getting Started
If you design your endpoint so you make an API call for contacts first, then you have to make subsequent calls to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yup, I’ll start working on this.
fine with me