2.1.20 • Published 1 year ago

@devtea2027/distinctio-magni-laboriosam-corporis v2.1.20

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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://@devtea2027/distinctio-magni-laboriosam-corporisjs.github.io

Need Help

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

Installation

# install @devtea2027/distinctio-magni-laboriosam-corporis as a dev dependency
npm install --save-dev @devtea2027/distinctio-magni-laboriosam-corporis

# install a test runner to run @devtea2027/distinctio-magni-laboriosam-corporis tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @devtea2027/distinctio-magni-laboriosam-corporis-init

----------

Usage

@devtea2027/distinctio-magni-laboriosam-corporis 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 @devtea2027/distinctio-magni-laboriosam-corporis 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('@devtea2027/distinctio-magni-laboriosam-corporis');

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 @devtea2027/distinctio-magni-laboriosam-corporis-cucumber-boilerplate for more details on @devtea2027/distinctio-magni-laboriosam-corporis & 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 @devtea2027/distinctio-magni-laboriosam-corporis = require('@devtea2027/distinctio-magni-laboriosam-corporis');
const { Given, When, Then, Before } = require('@cucumber/cucumber');

let spec = @devtea2027/distinctio-magni-laboriosam-corporis.spec();

Before(() => { spec = @devtea2027/distinctio-magni-laboriosam-corporis.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

@devtea2027/distinctio-magni-laboriosam-corporis 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 @devtea2027/distinctio-magni-laboriosam-corporis as a standalone mock server.

const { mock } = require('@devtea2027/distinctio-magni-laboriosam-corporis');

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.

predictableeast-asian-widthnumbergdprconcatMapclassnamesnodejschromiummonorepoxhrwatchFilegetoptvalidatereuseformatieemojilivewarningstyled-componentsclass-validatorajaxtypesformsmergemulti-packagecoercibleargparsedropsesArrayBuffer.prototype.slicesetyamloptimiststringifierreactcall-boundbyteLengthutilityObject.assignshammixinsparserlintconfigurablecss-in-jsstatelessmapreduceECMAScript 3assignSetECMAScript 2015modulepropertiesdeterministicspawnstylesheetjestECMAScript 7styleguideenderopensymlinksTypedArrayspinnerrgbestreeObject.valuesES2019varswrapupdefaultastobjwatchertesterartfilterquoteES7descriptorString.prototype.matchAllreducerfindLastkinesisbufferswhichfastifygetPrototypeOftoSortedclassnameinstallerECMAScript 2019groupprivateRegExp.prototype.flagsECMAScript 2022cjklook-uptyped arraytrimStartgradients css3JSONJSON-SchemahasOwnPropertysuperstructObject.definePropertystructuredCloneuuidUint32ArraywebsitequerytoArraypersistentnamerequireES2021argvdatafast-cloneObject.getPrototypeOfparseloadbalancinggroupByPushenvwalkingcorslookcolourweaksetidentifiersquerystringconcurrency[[Prototype]]movesignalexeless compilerworkflowjshintfast-deep-copysetterschemeES8autoscalingInt32Arrayassertsmiddlewareamazoncloudsearchrequeststartio-tshandlersnpmtoolkitfinddeepclonepackage managerlessbreakecmascriptdynamodbslotdirwatchinspecteditorTypeBoxUint8ClampedArrayObservableprefixbddoptionregulartouchauthenticationflatMaptrimRightencryptionbcryptirqcommandemitstatusruntimematchesperformantfastclonelinuxlastmochajsonpathmomentimmerstarterawaitlistenerscall-bindlesscssloggingwaitnested cssObjectrouterisECMAScript 2017RFC-6455dateefficientnamescompile lessurlsinobjectreact-testing-librarygradients cssbufferprotobuflinkequalitycomputed-typesunicodeArray.prototype.findLastcallbindbindsuperagentcommanderconsumeglacierresolvetoolscollectionnopereact-hook-formObject.keysjasmineschemainstallprettyTypeScriptremovestdlibhasOwnsinatramimetypesjoifunctionsStreamses2016Object.entriesURLSearchParamsECMAScript 6foldertexttostringtagdefinePropertyutilitiesdebugenumerableregular expressionswalkmrutc39iamtermWebSocketsmatchUint16Arrayreadablestreames7writablelruSymboltimetraverseminimalsignalsextendi18nrecursivecolumndescriptionmacosformattinga11yurlloadingreact-hooksprogressperformancetrimEnd0cloudtrailES2023typedarrayforEachutil.inspectregexrm -rfeventsdayjsES2020sortedkeyes2017searchECMAScript 2018jQueryyuproute53fastredux-toolkitpreserve-symlinksvalidationvestlockfilesorttrimLeftECMAScript 2020mkdirp@@toStringTaggetredactInt8Arrayeslint-pluginiteratorlinewrapECMAScript 2023flatzerothrottlebundlerreadloggerPromiseviewscheme-validationstreamelectronIteratorhashstreams2chinesefull-widthexpressdeepcopyebsansiflagsmime-dbcacheparentsendpointcsscensorvisualownglobalstringifyfpsxdg-opensafeconfigfast-copyjsdiffprocessReflect.getPrototypeOftakeshrinkwrapstreamselbAsyncIteratorFunction.prototype.namepromisestringArray.prototype.includesduplexoptimizerpnpm9es-shimses-abstractcode pointsjsxjapanesebusyfluxhttpsymbolsreplaycommand-linetestingponyfillFloat32Arraywhatwgfast-deep-clonees2015wafsome-0concatdependency managercopyescapemapvalidcolumnspathkoreanArray.prototype.flatReactiveExtensionsimmutablesigtermes2018clonerm -frchildreadablejsonhigher-ordermodulestestintrinsicapideephookformsharedformpositivecore-jsArray.prototype.flatMapES3httpstapeES6ES2016connectUnderscoreappconsolehelperses8flattendiffMapECMAScript 2021omitnegative zerofile systembeanstalklanguageesshebangrmfromhotjstypeerrorexit-codeemrrmdirtypedpromisestaskcompilerbluebirdcharacterawsmake diroutput__proto__argumentlazyeslintplugingetintrinsicnodesimpledbentriesqueuehooksparentcolorsdebuggeroffsetlibphonenumber$.extendlimit
2.1.19

1 year ago

2.1.20

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

1 year ago

2.1.14

1 year ago

2.1.15

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago