3.8.115 • Published 12 months ago

@patrtorg/odit-facere v3.8.115

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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://@patrtorg/odit-facerejs.github.io

Need Help

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

Installation

# install @patrtorg/odit-facere as a dev dependency
npm install --save-dev @patrtorg/odit-facere

# install a test runner to run @patrtorg/odit-facere tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @patrtorg/odit-facere-init

----------

Usage

@patrtorg/odit-facere 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 @patrtorg/odit-facere 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('@patrtorg/odit-facere');

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

let spec = @patrtorg/odit-facere.spec();

Before(() => { spec = @patrtorg/odit-facere.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

@patrtorg/odit-facere 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 @patrtorg/odit-facere as a standalone mock server.

const { mock } = require('@patrtorg/odit-facere');

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.

a11ydom-testing-libraryprunesymlinksroute53assertsflatteninferencerdsschemawarningjQuerywritableasyncttysharedarraybufferistanbullockfileObject.definePropertyrmdirJSON-Schemababelexpressions3utilsfullwidthdomremovelinkwindowpureESnextpathstyled-componentsSymbolharmonydataViewdirectorytapequerytyped arrayelasticacheprotojson-schema-validatorintrinsicurlObject.keysdynamodbObject.isrmcore-jscallboundarraybufferhelpers.envsymbolsRegExp#flagsclientjson-schema-validationiepoint-freeHyBioptimizerchineseeslintconfigomitsubprocessisloadbalancingsameValueZerochildrulesutilitiescssstringifydayjsbyteLengthes-shimsasciihooksjson-schemazerofast-deep-clonestructuredCloneiammatchAlles-shim APIJSONtoArraytaciteslint-pluginUint32Arrayargumentutil.inspectstylesvalidationtypesuser-streamsnopebinlastdependenciesfrommetadatareverseflatMaptypedarraysgetkarmaenvironmentshelperfpnodeRFC-6455mapimportexportes2016transformcolorfastcopyexpresstoolsairbnbreworkimmutableECMAScript 2022validateinspectpostcss-pluginchannelapollobindprivate dataflagsmomentpackage.jsonspawnqueuefunctionminimalfeedWeakSetownspeedhttpcharactershttpstrimLeftwgetcloudtrailStyleSheettypeerrorfnmatchsidezodglobalThissource maptostringtagwriterouterlookscheme-validationextraphonechaioptionnegativelocalhasOwnPropertyargsfile systemglobal objectcommander3ddeepfunction.lengthArrayBufferaccessibilityefficientworkflowECMAScript 2016globalUint8Array.gitignorejsonschemareduceCSSansiwebforktoobjectcloneArrayBuffer.prototype.sliceenumerableObservableinstallermkdirpfunctionalSetObservablesnpmsharedletfixed-widthisConcatSpreadableguiddescriptorparseshampolyfilloncetypescriptES2018ajvStreamxhrhigher-orderpromiseaccessorpicomatcheslintmovecolumnscontainsescapecurlroutinglibphonenumberdeep-copycallbindfsworkerquerystringgroupByreduxglobal this valuejestArray.prototype.filterfastifyArrayworkspace:*getPrototypeOfRxJStestprefixparentrapiddescriptionreadablestreamequalespreeInt8Arrayfetchfind-uprm -frdrop[[Prototype]]utilboundemojiinstrumentationfast-copyframeworkcloudformationECMAScript 2023constInt16ArrayfileebsasteventEmitterinvarianttimeelbartavafast-deep-copyinternal slotArray.prototype.flatloggergetterregular-expressionjshintautoscalingstablerm -rftrimlintreact-hookscoerciblevisualeffect-tses5awesomesaucedataviewpackagesnpmignoreassertionrequestdebuggerconfigsinatrabrowserlist256setterinhtmlacorn-0full-widthunicodeweakmapawsreversedswfeventDispatcherupES2016nativeESoptimistclassnamesdebugWebSocketposepropobjectmanipulationcircularECMAScriptpostcssbyteclislicerouteresolvees7terminaldeleteimportmodulesloadingFloat32Arrayfantasy-land_.extendimmerbyteOffsetsafefilterl10nlogSymbol.toStringTagfolderArray.prototype.includesxmlindicatortypedarraycss-in-jstoSortedamazonstoragegatewayendpointreducerUint8ClampedArray6to5qsregularprotocol-buffersemr__proto__eventsString.prototype.matchAlltransportcodesjoiwalkinges8positivefindLastIndexobjtypeofcollectionbinaryagentfastReactiveExtensionsbrowserprogressvalueregular expressionsArray.prototype.flatMapPromiseyuptypesafeshrinkwrapES2023weaksetECMAScript 3datatoolkitArray.prototype.findLastsnschromiumbundlerUnderscoreMicrosoftreact-hook-formcolumnperformantwhatwgObject.fromEntriesvaluesequalityhas-ownglobalsnamesuninstallfastcloneYAMLinstallestreearraysnegative zeroes6characterfullECMAScript 2018callFunction.prototype.namecallbackreact poseECMAScript 2019takergbbuffermonoreporeactpreprocessorcorevest0ReactiveXconsumestreamArray.prototype.flattenflatfpstranspilercloudwatchredactatomparser$.extendcomparecollection.es6defineInt32ArraykeysbusydeterministicURLSearchParamsES3colourcloudfrontcryptoidentifiersgetOwnPropertyDescriptormulti-packagejavascriptvariablesutilityhashcloudsearchmapreducenodejsajaxString.prototype.trimecmascriptexecfilecommandtslibstringObject.valuesPushcomputed-typesshebangoutputECMAScript 5ponyfillcommand-lineemitdotenvReflect.getPrototypeOfcode pointsRegExp.prototype.flagsdeepcopycall-bindquotereadconcatMapbrowserslistvpctsenvstarterkoreantrimEndschemecopyinputarktypewidthECMAScript 7sortedtrimStartrssiterateserializersetImmediatesomecjktypanionMapTypeScriptgraphqlmodulevalidatorObject.getPrototypeOfBigUint64ArraydeepclonewaitsuperstructArray.prototype.containsgdprdefinePropertyfunctionsxtermTypeBoxjsgenericsi18nserializebinariesreuseredirectBigInt64ArrayjapaneseprototypetouchmanagersearchcreatenameWeakMapjasminerecursivekeyECMAScript 2015classesreact-testing-librarymatchespopmotionsortstylingassignramdashellsymboldescriptorsnumbertoReversedpyyamlenvironmentmobilequeueMicrotaskstringifierec2Array.prototype.findLastIndexfindLastignorerequirecheckwaapigitignoreapiiteratorsesmatchspinnerpushparentserrordependency managerECMAScript 2020slotspinnerscoveragefindtapbufferswalkwafyamlperformanceES2019runtimebannerObject.entriesconsoleeslintpluginstreamsrfc4122compilerreal-timecurriedcall-boundrobustTypedArrayspringstylemergees-abstractjsdifftranspilecacheexechasloggingArrayBuffer#slicelanguageES8proxyselfchromeRxformsprivateio-tsES2017ES7forEachFloat64ArraytextframerhasOwnES6package managerECMAScript 2021jsdomes2018rangeerrorpnpm9toStringTagpackagegesturesmake dirformattingtddmruelectronredux-toolkitidlespecmkdiruuidwhichhardlinkstesterpropertiesObjectpinoconfigurableECMAScript 2017trimRighttypejsxmkdirsWebSocketsIteratorsyntaxpatchanimationreadabletypedformvarform-validationtelephonesimpledbdateconcatdragshimeveryformatmakeescolorsautoprefixerfindupECMAScript 6protobufdirES2020tc39AsyncIteratorfast-cloneeast-asian-widthpipeoffsetpluginprocessvarssuperagentarrayasterisksURLkinesisvalidES2022babel-corelistenersStreamstraverseES2021hookformexecutees2015beanstalkviewlook-upsetlocationdeep-clonethreesyntaxerrorsetPrototypeOfObject.assignappregexassertbundlingmochaextendes2017termargvregular expressionzxES5serializationjsonstyleguiderandomclassnamesettingsSystem.globalglobprettygetoptrestfulidgroupinternalfigletclass-validatordiffregexpUint16ArrayflagpropertyES2015rest@@toStringTagreact animationcensorlruenderentriesCSSStyleDeclarationbddincludesgetintrinsic
3.8.113

12 months ago

3.8.114

12 months ago

3.8.115

12 months ago

3.8.112

12 months ago

3.8.111

12 months ago

3.8.110

12 months ago

3.8.109

12 months ago

3.8.108

1 year ago

3.8.107

1 year ago

3.8.106

1 year ago

3.8.105

1 year ago

3.8.104

1 year ago

3.7.104

1 year ago

3.7.103

1 year ago

3.7.102

1 year ago

3.7.101

1 year ago

3.6.101

1 year ago

3.5.101

1 year ago

3.4.101

1 year ago

3.4.100

1 year ago

3.4.99

1 year ago

3.4.98

1 year ago

3.4.97

1 year ago

3.4.96

1 year ago

3.4.95

1 year ago

3.4.94

1 year ago

3.4.93

1 year ago

3.4.92

1 year ago

3.4.91

1 year ago

3.3.91

1 year ago

3.3.90

1 year ago

3.3.89

1 year ago

3.3.88

1 year ago

3.3.87

1 year ago

3.3.86

1 year ago

3.3.85

1 year ago

3.3.84

1 year ago

3.2.84

1 year ago

3.2.83

1 year ago

3.2.82

1 year ago

3.2.81

1 year ago

3.2.80

1 year ago

2.2.80

1 year ago

2.2.79

1 year ago

2.2.78

1 year ago

2.2.77

1 year ago

2.2.76

1 year ago

2.2.75

1 year ago

2.2.74

1 year ago

2.2.73

1 year ago

2.2.72

1 year ago

2.2.71

1 year ago

2.2.70

1 year ago

2.2.69

1 year ago

2.2.68

1 year ago

2.2.67

1 year ago

2.2.66

1 year ago

2.2.65

1 year ago

2.2.64

1 year ago

2.2.63

1 year ago

2.2.62

1 year ago

2.2.61

1 year ago

2.2.60

1 year ago

2.2.59

1 year ago

2.2.58

1 year ago

2.2.57

1 year ago

2.2.56

1 year ago

2.2.55

1 year ago

2.2.54

1 year ago

2.2.53

1 year ago

2.2.52

1 year ago

2.2.51

1 year ago

2.2.50

1 year ago

2.2.49

1 year ago

2.2.48

1 year ago

2.1.48

1 year ago

2.1.47

1 year ago

2.1.46

1 year ago

2.1.45

1 year ago

2.0.45

1 year ago

2.0.44

1 year ago

2.0.43

1 year ago

2.0.42

1 year ago

2.0.41

1 year ago

2.0.40

1 year ago

2.0.39

1 year ago

2.0.38

1 year ago

1.0.38

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago