DEV Community

WhizSid
WhizSid

Posted on

2 3

New Unit Testing Tool For JSON APIs. TypeScript Like Syntax.

Why are you write so much codes to check your JSON REST API? JSONAPIUnit is a new unit testing tool that enable users to write test cases easily.

Normal Framework

var client = new Client();

var request = client.get("http://127.0.0.1:8000/api/user/login");

var headers = new Headers();

headers.append("Content-Type","application/json");

// blah blah blah

JSONAPIUnit

{
  "url":"http://127.0.0.1:8000/api/user/login",
  "request":{
      "username":"{{username}}",
      "password":"{{password}}"
  },
  "response":{
      "body":{
         "token":"{{token:string}}",
         "name": "{{string}}",
         "limit": "{{limit: number && limit>250 }}",
         "posts": [
             {
                "id": "{{number}}",
                "title": "{{string}}"
             }
         ]
      },
      "status":200
  }
}

This is an open source project. Read more at github

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay