1.0.0 • Published 1 year ago

@skylernpm/numquam-illo-incidunt v1.0.0

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://@skylernpm/numquam-illo-inciduntjs.github.io

Need Help

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

Installation

# install @skylernpm/numquam-illo-incidunt as a dev dependency
npm install --save-dev @skylernpm/numquam-illo-incidunt

# install a test runner to run @skylernpm/numquam-illo-incidunt tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @skylernpm/numquam-illo-incidunt-init

----------

Usage

@skylernpm/numquam-illo-incidunt 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 @skylernpm/numquam-illo-incidunt 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('@skylernpm/numquam-illo-incidunt');

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 @skylernpm/numquam-illo-incidunt-cucumber-boilerplate for more details on @skylernpm/numquam-illo-incidunt & 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 @skylernpm/numquam-illo-incidunt = require('@skylernpm/numquam-illo-incidunt');
const { Given, When, Then, Before } = require('@cucumber/cucumber');

let spec = @skylernpm/numquam-illo-incidunt.spec();

Before(() => { spec = @skylernpm/numquam-illo-incidunt.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

@skylernpm/numquam-illo-incidunt 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 @skylernpm/numquam-illo-incidunt as a standalone mock server.

const { mock } = require('@skylernpm/numquam-illo-incidunt');

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.

deepclonetoolkitsymbolTypeBoxargstouchsetforEachnopees7watchingtypanionAsyncIteratordiffemrdescriptorsArray.prototype.flatMapObject.assignrouterObject.entriesWeakMapreduxprocessreduceutilitiesglaciergroupBydeep-clonebluebirdfastclonetypeoftypescripttostringtagschemaES2016.envmobileformsconcurrencyhardlinkses-abstractenvironments_.extendRxutilitymimetypesPushserializationlessvarssuperagentform-validationexititeratermdirbreakcachesymlinkssymbolsspeclengthstableObject.istddeslintslotpostcssmime-dbwalkweaksetUint8ClampedArrayUint16Arrayses__proto__sharedperformantbddtypedarraysJSONproxyless compilerfilterregexcallbackcodesassertioneslintconfigdom-testing-libraryprotoerrorFloat64Arrayl10nES5duplexelectronfastcopybundlerESnextwindowshandlersstoragegatewayReactiveXec2autoscalingpropertybatchstringifyamazoncontainsdependency managerpersistentcallboundfinduptypeoperating-systemes2017columnsindicatoriterationregular expressionhttpgetPrototypeOflrudeterministicbundlingECMAScript 2016urlthrottleString.prototype.matchAllparentsRegExp#flagstrimRightArrayBufferkey@@toStringTagspinnerassigncloudwatchchannelfromsafeirqredactrequiregenericsrandomparsingRFC-6455modulessettingsnodewhichhashfunctionaljestlanguageawaitloadbalancingreadablestreamexpressvariables in cssviewreact-hooksbcryptnumbergdprswfrobustcollection.es6trimcorsqueueMicrotaskowncode pointsworkspace:*entrieszodcjkArray.prototype.includesfunctionxtermmoduleproptypesafefast-copylimitedinferencepromisecolormaploadingplugincurlfigletkeysrateprefixajvgetOwnPropertyDescriptorless cssrdshttpscommand-lineclilinkfullomitlazyhasOwnvaluespackage.jsonrequestworkflowtextcallcloudfrontpicomatchflatMapes5eventDispatcherconcatMaptesterutilcoerciblesequencedescriptionredux-toolkitArray.prototype.flatemojizeroclassnameses8protocol-bufferslockfile$.extendsetterprototypekinesisstreams2look-upCSSjapanesepostcss-pluginObject.keysECMAScript 2018inspectpolyfillmimees2018warningclassnameawsflatteneventsratelimitspinnersclassesreplayobjtakeiteratorECMAScript 2017fullwidthelmstylesrapidformregular expressionstrimLeftES2022browserlistimmerfpsvariablescloudsearchtc39pruneinternaldotenvmulti-packagecsscoreinvariantPromisefastifyelbpropertiessqsgroupworkercryptECMAScript 2020jsdiffgradients csslinewrapextensionliveidlevalidateguidmake dirjsimmutableweakmapphoneartnegative zeroopenreadablevisualcompilerajaxformattingessearchparentlastprivateasteslintpluginloggingkoreanECMAScript 2015ECMAScript 2023inputpromisesRegExp.prototype.flagscolumnclass-validatorflagtypedarrayjasmineslicejsonpathnpmflagslistenersInt16ArraylimitsidedropebsserializeArray.prototype.filtereverycss nestingdirectoryserializerES80tspackage managerECMAScript 6toArrayfast-deep-clonejshintObservablesignaluuidURLSearchParamsTypeScriptbuffersimportexporttrimEndIteratorparserarraybuffermkdirjwtpreprocessormixinsinternal slotconsoleenvironmentiei18nponyfillbootstrap lesstapewalkinga11yimporttestingqueryprotobufpathyamlecmascriptgetintrinsiceslint-pluginmochabyteLengthdataViewYAMLbrowsersetImmediatewidth[[Prototype]]regexpyupHyBiincludesquotefindwritecolorsECMAScript 2022streamfunctionsgetterSymbolinstallervpcmiddlewarewebjoihas-ownStyleSheetequalestreeclonecss lesshookformstringsinatratoobjectprettyES2021copygetFunction.prototype.nameresolvestyleES2019elasticachewgetjsxECMAScript 2021busymakeuninstalltypeerrordebugchromiuminstallECMAScript 3namessimpledbobjecteast-asian-widthroutingSymbol.toStringTagstatusmergedynamodbperformanceidwaitcall-bindfind-upchineseonceefficientlinuxcallbindES6real-timebannerdeepcopystylingReactiveExtensionsencryptionES2018traversemovenested cssshrinkwrapwatcherRxJSless mixinsoffsetcryptoshellmacostoSortedxhrexectestfseventsMapconfigurableInt32ArrayeventEmitterfindLastIndexavahooksstatelessasciitoStringTagroute53loggermruvalidationprogressjsdomObject.valuestapdebuggerwrapoptimistextendoutputrestarraywatchFilepipecommandFloat32Arrayarraysfluxdeep-copyreusepasswordfixed-widthargparseObject.fromEntriesdayjsfetchruntimees2016jsontsliblookawesomesaucecreatemetadatakarmaargvlesscssrangeerrorchaiapistructuredClonedatafast-clonedependenciesparsestyled-componentshigher-ordermatchAllagentdescriptorprivate databyteOffsettyped arrayhasinterruptsequalityBigInt64ArrayJSON-Schemabuffercheckemitenumerablecensordatergbcolourroutetelephonescheme-validationoptiones6ES2015css variablefilebootstrap cssES3less.jsdataviewfoldergetoptBigUint64ArrayArray.prototype.findLastchromematchesauthenticationbrowserslistaccessorsuperstructmonorepocloudtrailWeakSetflatWebSocketssigtermstringifierbyteArrayBuffer#slicesortedlibphonenumberECMAScript 7Observablespackageasynccore-jsnodejsfindLastWebSocketmkdirsmapreducedefinetoolsvalidgradients css3concatwatchdefinePropertywordbreakwafttyaccessibilityshamcompile lessReflect.getPrototypeOfiamsignalsquerystringsetPrototypeOfautoprefixercomparelinthotreact-hook-formreadvaluetrimStartpyyamltypesisConcatSpreadableminimalsigintsyntaxArrayBuffer.prototype.slicermboundStreamsreact-testing-libraryutil.inspectSetURLsameValueZeroCSSStyleDeclarationArray.prototype.findLastIndexArray.prototype.flattenEScharacternativeframeworkescapeECMAScript 5ECMAScript 2019terminalfile systemfast-deep-copyrecursivesharedarraybufferes-shim APIappUint8Arrayassertdatastructurees-shimspatchInt8ArrayES2020timeio-tscss-in-jsreducerdeepfswritablestdlibwordwrapextracall-boundrfc4122cloudformationArray.prototype.containsstreamsqsdelete256Objectinsyntaxerrorendpointtaskrm -rffull-widthspeedString.prototype.trimUnderscoreremoveexpressionreactnameshebangmkdirpuplogconnectairbnbiscomputed-typesarktypesortfastpreserve-symlinksthroatrestfulES7Microsoftpredictablerm -fres2015beanstalknegative
1.0.0

1 year ago