5.9.96 • Published 10 months ago

@taktikorg/delectus-fuga v5.9.96

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@taktikorg/delectus-fuga

npm version Build Dependency Status Coveralls Maintainability Known Vulnerabilities Gitter

Structured testing of seneca plugin messages.

Run Seneca messages in series (not parallel) to validate behavior against expectations.

Example

See example folder

Note

To use @hapi/joi, require with:

const Joi = require('@taktikorg/delectus-fuga').Joi

This ensures that the Joi versions match.

Test Specification

# file: test-spec.js
module.exports = {
  print: true,
  pattern: 'role:foo',
  data: {
    foo: {
      bar: {
        b0: { id: 'b0', b: 0 },
        b1: { id: 'b1', b: 1 }
      }
    }
  },
  calls: [
    {
      // combined with top level pattern to form msg: 
      // role:foo,cmd:get,id:b0
      pattern: 'cmd:get',
      params: { id: 'b0' },
 
      // output result must match this Optioner (Joi-based) structure
      // https://github.com/rjrodger/optioner
      out: { b: 0 }
    },
    {
      // name a call to reference it later
      name: 'list-0',
      pattern: 'cmd:list',
      params: {},
      out: [{b: 0}, {b: 1}]
    },
    {
      pattern: 'cmd:get',
      // use https://github.com/rjrodger/inks back reference syntax
      params: { id: '`list-0:out[1].id`' },
      out: { b: 1 }
    },
  ]
}

Test code

# basic.js
const Seneca = require('Seneca')
const SenecaMsgTest = require('..')

const seneca = Seneca().test()

// Test specification
const test_spec = require('./test-spec.js')


// Define some simplistic message actions
seneca
  .use('promisify')
  .use('entity')
  .message('role:foo,cmd:get', async function(msg) {
    return this.entity('foo/bar').load$(msg.id)
  })
  .message('role:foo,cmd:list', async function(msg) {
    return this.entity('foo/bar').list$()
  })

// Use this inside your testing code
const run_msgs = SenecaMsgTest(seneca, test_spec)

async function run_test() {
  await run_msgs()
}

run_test()

Printed output (optional)

CALL   :  cmd:get { id: 'b0' }
ERROR  :  null
RESULT :  $-/foo/bar;id=b0;{b:0}


CALL   :  cmd:list {}
ERROR  :  null
RESULT :  [ $-/foo/bar;id=b0;{b:0}, $-/foo/bar;id=b1;{b:1} ]


CALL   :  cmd:get { id: 'b1' }
ERROR  :  null
RESULT :  $-/foo/bar;id=b1;{b:1}
assignUint8Arraycensorefficientargvreact-testing-libraryenvironmentfromArray.prototype.findLastIndexstylingbabeldescriptorECMAScript 2019iamcontainsexpressionspecexecgraphqlexecuteonceBigInt64ArraysharedarraybufferdataviewshimfastifyvariablesES2023CSSvalidpnpm9chromiumdeepclonerobustECMAScript 2020commandercolorsemrthreefunctionsfast-copyES5apicomputed-typesmergeStreamsbrowsergetOwnPropertyDescriptortranspilemapreduceemojil10nasterisksimportECMAScript 3configrouteproxytrimEndmapperformantpropertymatchpoint-freeTypeBoxoutputpackage manageriteratorFloat32Arrayaccessibilityconcatwgetwindowjson-schemaWebSocketredirectacornescapepackageinstallerStreamtakerm -framazontestrfc4122command-linetapearttc39mkdiruser-streamsrulesmulti-packagetypanionreact posereducecollectionbyteArray.prototype.flattenES2019redactcjkzeroassertsenvrecursiveUint16ArraymonorepocssinferencesidepatchassertionECMAScriptes2018syntaxECMAScript 2015endergetObservableboundtouchimmutabledataViewastrsscallconcatMaptimeextraflagwritableendpointtransportchannelreversestyleArrayBufferRxJSmanipulationserializerqueryappreducerselfuuidlistenersESnextcore-jstypeofexpressbrowserlisttoReversedlogbuffersYAMLfpses2016compilerjshintreadablefolderutilserializeObject.keysPushidentifiersglobpluginInt8ArraynativeidleStyleSheetchromeflagspropagentttyvarsnegative zerohtmlparentglobal this valuemanagertypescriptreact-hookssubprocessString.prototype.trimapollotypeseventEmittertoolkitreactgetoptsetImmediatedomInt16Array$.extendlookECMAScript 5lintconsumeflatMapspringtraverseobjectglobalstypedarraysecmascriptvaluesfull-widthparsercallbackmobileoffsetchildES6Array.prototype.flatMapsharedcloudtrailforkqueueclassesjsoncall-bindfullclientArray.prototype.flatURLSearchParamswalkingdropcorermgetPrototypeOfawstoobjectes6protocol-buffersdateprotobufdeterministiclook-upArray.prototype.includesoptionnpmignoredefineECMAScript 2016binarieses5walknamestreamcodesstreamslengthsuperagentweakmapPromiseglobal objectreact-hook-formtransformfilefindupECMAScript 2017file systemmodulehasOwnexecfilextermec2ebsnpm.gitignorestoragegatewayObject.entriespostcsswafsortedreal-timegenericsscheme-validationtslibsetPrototypeOfiterateprettydirectoryURLshellnegativeassertbeanstalkupspawngroupvpc_.extendform-validationreadablestreamvestasciizodES2020japanesebabel-coreshamyamldotenvpushresolvecoveragemovecreatereact animationjoi__proto__lrus3bddmake dirHyBideep-cloneeslintprivateglacierES7toArraylocallibphonenumberrapidArrayBuffer#slicehigher-orderpureargumentcurlnumberserializationajaxstyled-componentscircularUint8ClampedArrayes-abstractchecktelephonefixed-widthpolyfillgetterpositivees-shim API0WebSocketsMaptoolsclass-validatortrimStarttoSortedjsxcolumnselbquerystringdraghardlinksfastschemafilterglobalThishasformsdependency managerfastcopyincludesextendES2021redux-toolkitchineseregular-expressionurldeepcopyzxRxtyped arraypyyamlFloat64Arraywhichroutinginvariantbundlingidsymbolarraysoptimistatomeast-asian-widthines2017ES2018es7cryptoprotofind-upfunction.lengthramdaargsReflect.getPrototypeOfInt32ArraytranspilervalidatorArray.prototype.filterimportexportreversedgitignoreespreeyupbuffercloneprocessloggerobjtermwaapivisualeventDispatcherArray.prototype.findLastESeverycallbindguidrdsphonesortpropertiesautoscalingtypesafeeventsdependenciesSymbol.toStringTag.envjsdomRegExp#flagsFunction.prototype.nameistanbulqueueMicrotaskflatunicodedom-testing-librarybinarylocationhasOwnPropertylockfilesyntaxerrorcachestringifyES2022[[Prototype]]coercibletypedarraydataAsyncIteratorchaitostringtagArray.prototype.containskoreanequalityreadkinesisprototyperouterECMAScript 2021instrumentationoptimizertestermatcheshelpertoStringTagisshrinkwrapBigUint64ArrayECMAScript 7requireregexcloudwatchmatchAllRegExp.prototype.flagswebuninstallparseObject.definePropertySetsettingsfantasy-landsomeruntimeajv-0fnmatchhelpersterminaltypeerrorpicomatchUint32ArrayfigletrangeerrorES2015CSSStyleDeclarationnopeomitponyfillsnssqsIteratorescall-boundcss-in-jslinksliceaccessorfastcloneprogressReactiveExtensionselectronhookspackagesmkdirpdefinePropertypathenvironmentsanimationArrayBuffer.prototype.slicerestfulweaksetregexpmomentsetutil.inspectcommandconst3dbindcharacterssymlinksObject.valuesbyteLengtheslintconfigcloudformationinput6to5debuggerdeep-copyutilitieswhatwgloggingrgbstringifierbusyschemecolourfprequesttypedflattentrimRightECMAScript 6stablehttpcomparecopyUnderscorejsdeleteprunefullwidthfetchsuperstructworkflowgesturesjson-schema-validationwarningjson-schema-validatortypees-shimsnodejsbyteOffsetshebangswfio-tses2015TypedArraykarmavalidationparentsfindLaststylesremoveconsoleObject.getPrototypeOfeffect-tsECMAScript 2022arraybufferrmdirspeedroute53autoprefixercode pointsgdprjsdiffreworkclassnamesminimalWeakMapignorees8stringcolumnMicrosoftfeedtrimeslint-pluginloadbalancingfast-deep-copyownglobaljestxmlmetadataquotegroupByvarmkdirsSymbolcallboundgetintrinsicwaitlastforEachcloudfrontfunctionentriesperformancecollection.es6JSONasyncutilitypipetesting@@toStringTagpackage.jsonregular expressionjsonschemabrowserslistintrinsicfsObservableswriteObject.assignReactiveXJSON-Schemafast-deep-cloneelasticachecolorpreprocessorES3i18neslintpluginviewsymbolsreuseObject.ismochasearchansiisConcatSpreadabletsjasmineinstallframerjQueryutilstdd256ES2016keysestreeECMAScript 2023functionalequalqserrorsimpledbtrimLeftcharacterdescriptionhookformSystem.globaldescriptorssameValueZerofindtacittextstarteremitmodulesawesomesauceObjectWeakSetfindLastIndexpromiseclassnamedebugpinorandomprefixindicatorslotRFC-6455spinneriepostcss-pluginloadingfast-clonewidthsource mapletairbnbmakea11ydayjsArraymruinternal slotregular expressionskeyarktypetaphash
5.9.96

10 months ago

5.9.95

10 months ago

5.9.94

10 months ago

5.9.93

10 months ago

5.9.92

10 months ago

5.9.91

10 months ago

5.8.91

10 months ago

5.8.90

11 months ago

4.8.90

11 months ago

4.8.89

11 months ago

4.8.88

11 months ago

4.8.87

11 months ago

4.8.86

11 months ago

4.8.85

11 months ago

4.8.84

11 months ago

4.8.83

11 months ago

4.8.82

11 months ago

4.8.81

11 months ago

4.8.80

11 months ago

4.8.79

11 months ago

4.8.78

11 months ago

4.8.77

11 months ago

4.8.76

11 months ago

4.8.75

11 months ago

4.8.74

11 months ago

4.8.73

11 months ago

4.8.72

11 months ago

4.7.72

11 months ago

4.7.71

11 months ago

4.6.71

11 months ago

4.6.70

11 months ago

3.6.70

11 months ago

3.6.69

11 months ago

3.6.68

11 months ago

3.6.67

11 months ago

3.6.66

11 months ago

3.6.65

11 months ago

3.6.64

12 months ago

3.6.63

12 months ago

3.6.62

12 months ago

3.6.61

12 months ago

3.5.61

12 months ago

3.5.60

12 months ago

3.5.59

12 months ago

3.5.58

12 months ago

3.5.57

12 months ago

3.5.56

12 months ago

3.5.55

12 months ago

3.5.54

12 months ago

3.5.53

12 months ago

3.5.52

12 months ago

3.5.51

12 months ago

3.5.50

12 months ago

3.4.50

12 months ago

3.3.50

12 months ago

3.3.49

12 months ago

3.3.48

12 months ago

3.3.47

1 year ago

3.2.47

1 year ago

3.2.46

1 year ago

3.2.45

1 year ago

3.2.44

1 year ago

3.2.43

1 year ago

3.2.42

1 year ago

3.2.41

1 year ago

3.2.40

1 year ago

3.2.39

1 year ago

2.2.39

1 year ago

2.2.38

1 year ago

2.2.37

1 year ago

2.2.36

1 year ago

2.2.35

1 year ago

2.2.34

1 year ago

2.2.33

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.2.30

1 year ago

2.2.29

1 year ago

2.2.28

1 year ago

2.2.27

1 year ago

2.2.26

1 year ago

2.2.25

1 year ago

2.2.24

1 year ago

2.2.23

1 year ago

2.2.22

1 year ago

2.2.21

1 year ago

2.2.20

1 year ago

2.2.19

1 year ago

2.2.18

1 year ago

2.2.17

1 year ago

2.2.16

1 year ago

2.2.15

1 year ago

2.2.14

1 year ago

2.2.13

1 year ago

2.2.12

1 year ago

2.2.11

1 year ago

2.2.10

1 year ago

2.2.9

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

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago