1.0.5 • Published 6 days ago

@teamteanpm2024/voluptate-fuga-repellendus v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

logo

PactumJS

Build Coverage Downloads Size Platform

Stars Twitter

REST API Testing Tool for all levels in a Test Pyramid

PactumJS is a REST API Testing Tool used to automate e2e, integration, contract & component (or service level) tests.

  • ⚡ Swift
  • 🎈 Lightweight
  • 🚀 Simple & Powerful
  • 🛠️ Compelling Mock Server
  • 💎 Elegant Data Management
  • 🔧 Extendable & Customizable
  • 📚 Clear & Comprehensive Testing Style
  • 🔗 Component, Contract & E2E testing of APIs

----------

Documentation

This readme offers an basic introduction to the library. Head over to the full documentation at https://@teamteanpm2024/voluptate-fuga-repellendusjs.github.io

Need Help

We use Github Discussions to receive feedback, discuss ideas & answer questions.

Installation

# install @teamteanpm2024/voluptate-fuga-repellendus as a dev dependency
npm install --save-dev @teamteanpm2024/voluptate-fuga-repellendus

# install a test runner to run @teamteanpm2024/voluptate-fuga-repellendus tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @teamteanpm2024/voluptate-fuga-repellendus-init

----------

Usage

@teamteanpm2024/voluptate-fuga-repellendus can be used for all levels of testing in a test pyramid. It can also act as an standalone mock server to generate contracts for contract testing.

API Testing

Tests in @teamteanpm2024/voluptate-fuga-repellendus are clear and comprehensive. It uses numerous descriptive methods to build your requests and expectations.

Simple Test Cases

Using Mocha

Running simple api test expectations.

const { spec } = require('@teamteanpm2024/voluptate-fuga-repellendus');

it('should be a teapot', async () => {
  await spec()
    .get('http://httpbin.org/status/418')
    .expectStatus(418);
});

it('should save a new user', async () => {
  await spec()
    .post('https://jsonplaceholder.typicode.com/users')
    .withHeaders('Authorization', 'Basic xxxx')
    .withJson({
      name: 'bolt',
      email: 'bolt@swift.run'
    })
    .expectStatus(200);
});
# mocha is a test framework to execute test cases
mocha /path/to/test

Using Cucumber

See @teamteanpm2024/voluptate-fuga-repellendus-cucumber-boilerplate for more details on @teamteanpm2024/voluptate-fuga-repellendus & cucumber integration.

Scenario: Check Tea Pot
  Given I make a GET request to "http://httpbin.org/status/418"
  When I receive a response
  Then response should have a status 418
// steps.js
const @teamteanpm2024/voluptate-fuga-repellendus = require('@teamteanpm2024/voluptate-fuga-repellendus');
const { Given, When, Then, Before } = require('@cucumber/cucumber');

let spec = @teamteanpm2024/voluptate-fuga-repellendus.spec();

Before(() => { spec = @teamteanpm2024/voluptate-fuga-repellendus.spec(); });

Given('I make a GET request to {string}', function (url) {
  spec.get(url);
});

When('I receive a response', async function () {
  await spec.toss();
});

Then('response should have a status {int}', async function (code) {
  spec.response().should.have.status(code);
});

Mock Server

@teamteanpm2024/voluptate-fuga-repellendus can act as a standalone mock server that allows us to mock any server via HTTP or HTTPS, such as a REST endpoint. Simply it is a simulator for HTTP-based APIs.

Running @teamteanpm2024/voluptate-fuga-repellendus as a standalone mock server.

const { mock } = require('@teamteanpm2024/voluptate-fuga-repellendus');

mock.addInteraction({
  request: {
    method: 'GET',
    path: '/api/projects'
  },
  response: {
    status: 200,
    body: [
      {
        id: 'project-id',
        name: 'project-name'
      }
    ]
  }
});

mock.start(3000);

----------

Notes

Inspired from frisby and pact.

Support

Like this project! Star it on Github and follow on Twitter. Your support means a lot to us.

Contributors

If you've ever wanted to contribute to open source, and a great cause, now is your chance! See the contributing docs for more information.

Thanks to all the people who contribute.

rm -frbrowserslistmacosagentpackagesglacierreduxchinesecryptopreprocessorInt32Arraycloneintrinsic0readparseanimationYAMLuninstallmochaBigUint64Arraylesscssnodedeletecall-bindcurlnested cssObjectmobilejsonbootstrap lessajaxoptimizerexit-codefind-upObject.keysdeep-copybcryptcolourownansiRxcall-boundReflect.getPrototypeOfterminales2016babelvaluepostcssgdprinvarianthttpsutilstsasciiprotocol-buffersdataviewwritabletranspilervalidationes7getPrototypeOftoobjectrecursivesuperstructBigInt64Arrayexeccolumnletpolyfillinstalllimitedmulti-packageweakmapstringifygetexitHyBislotname__proto__deepclonemimetypesspringECMAScript 2022everyjson-schemasymbolstc39curriedescapeforEachrequireiteratorsanitizationassertshamtimesymboljsxaccessorlinkenvironmentshrinkwrapsimpledbnumberes2015getintrinsicsyntaxrgbECMAScript 6Function.prototype.name256sigintECMAScript 5Symbol.toStringTagsesbytefastcopy-0wrapcore-jsmonorepoURLSearchParamslook-upmodulesfast-deep-clonebalancedsidelinewrapAsyncIteratorlintes8frameworkargsECMAScript 2015commandersettingsnodejswalkingprotobufponyfillimmerpreserve-symlinkstestingcompilerelectronduplexhttpsetterprotostylesheethandlersimmutableeslint-pluginkoreanECMAScript 2021watchFilewaitscheme-validationcomputed-typessignaljson-schema-validatorbindArray.prototype.flatiterateStreamsec2consumeyupfastifydescriptorsonceamazonFloat32ArrayES2019zodkinesissyntaxerrorcolorspostcss-pluginUint8ClampedArrayiterationauthRegExp.prototype.flagsinferencestatelessutilspecviewjavascriptfastclonepluginutilityargumentrm[[Prototype]]whatwgbrowsertoolsjsemrinputratemiddlewarecallbackRegExp#flagswebstreambyteLength3dio-tssliceES2018l10ntouchtypevalidgroupbddenderdebuggeruser-streamsconcatMappruneArray.prototype.flatMaputil.inspectexpressionerrorinterruptsECMAScript 2018importdefineObject.assignschemaparentfindupeventEmitterentriesinquerystringworkspace:*mimecloudfrontwhichextramixinscss lessES3UnderscorematchesstringES5jasminecloudformationECMAScript 7optimistObservabletrimLeftassertiondroploadbalancingSetreduceparserprettycjkArrayBuffer#slicegetterArray.prototype.includes
1.0.5

6 days ago

1.0.4

7 days ago

1.0.3

8 days ago

1.0.2

9 days ago

1.0.1

10 days ago

1.0.0

10 days ago