npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

claw-suite

v1.1.0

Published

Automation testing tool without OOPS

Downloads

12

Readme

Claw-Suite

Prerequisite

  • claw-suite
  • dotenv

Installation

If you already have dotenv installed

npm i claw-suite

else

npm i claw-suite dotenv

Recommended File Structure

- index.js (your main js file)
- tests
    -- tc1.test.js (anyfile with extension as .test.js)
    -- tc2.test.js
    -- testFolder (embedded folders also works)
        --- tc3.test.js ...
- schema
    -- SampleSchema.js (schema check for api if needed)
- .env (for environment variables storage)
- node_modules
- package.json
- package-lock.json

Usage

Its is very simple to use and the configuration is not much complex as you think

Inside the main file we can import claw-suite

.env (environment variables)

BASE_URL="http://localhost:5000"
AUTH_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

index.js (any main files names)

import claw from "claw-suite";
import dotenv from "dotenv";

dotenv.config();

claw.config("./tests");
// ./tests indicates the testcase file path if you have any other names give it as parameter

test files (inside tests folders *.test.js)

import claw, { validate } from "claw-suite";

claw.scratch("test case name", "test case description", async () => {
    let resp = await claw.get({ endpoint: "/get" });
    return validate.ok.isEqual(resp, "get response");
});

// if returned true logged in green in terminal
// if validation fails logged as red in terminal

Schema file

Under dev ...

Request Functionalities

For most of the functionalites we have autofilled parameters like baseUrl and auth token since it is configured in .env file.

| Functionality | Syntax | Return | | ------------- | ------------------------------------------------ | ------------------------ | | POST | claw.post( {baseUrl, endpoint, body } ) | {response, responseData} | | GET | claw.get( {baseUrl, endpoint } ) | {response, responseData} | | GET by id | claw.getById( {baseUrl, endpoint, id } ) | {response, responseData} | | GET by query | claw.getByQuery( {baseUrl, endpoint, query } ) | {response, responseData} | | GET by params | claw.getByParams( {baseUrl, endpoint, params } ) | {response, responseData} | | PUT | claw.put( {baseUrl, endpoint, id, body } ) | {response, responseData} | | PATCH | claw.patch( {baseUrl, endpoint, id, body } ) | {response, responseData} | | DELETE | claw.delete( {baseUrl, endpoint } ) | {response, responseData} | | DELETE by id | claw.deleteById( {baseUrl, endpoint, id } ) | {response, responseData} |

Validation Functionalities

Validation initially checks the status of response like (200 - OK, 404 - NotFound, etc .,)

| Functionality | Syntax | Return | | ------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | is equal | validate.ok.isEqual(actualResponse, expectedResponse) | true / false | | json equality check | validate.ok.jsonCheck(actualResponse, expectedResponse) | true / false | | json schema check | validate.ok.jsonSchemaCheck(actualResponse, expectedResponse, schema) | true / false |