6.8.107 • Published 10 months ago

@diotoborg/corrupti-beatae v6.8.107

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

@diotoborg/corrupti-beatae

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('@diotoborg/corrupti-beatae').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}
equalityTypeBoxObject.keysframeworkfunctionsUint16Arrayhttparrayszerocomputed-typesrequirefinddebuggerYAMLSetquerytypedefinePropertyastharmonyjsxexpressioncoveragejQuerystyled-componentstermmkdirsresttesterhasOwnjavascriptmovecollection.es6defineprotocol-bufferslogtextruntimeemitfindLastlettimeclonetypescripttostringtagramdaisConcatSpreadableeslintpluginECMAScript 2020reactquerystringfull-widthgitignorebabelchannelclassesuuidstylescolourserializerenvironmenterrorincludeswalkgenericsflagskinesistdddeep-copyglobal this valuecall-boundinternalexecfilefastifyutilitiesimportexportcheckjasminecreatesyntaxerrorequalmodulescharactersSystem.globalsharedarraybufferfnmatchpatchWeakMapES2018ECMAScript 6startercryptohtmlArrayBuffer.prototype.slicehashtyped arrayfeedwebstreamdescriptionreact poseiddeepclonestoragegatewayargvsnszxreworkarraybufferflatinstrumentationnodemake diriterateglobcss-in-js-0atomwgettypeofarrayebsjson-schemaFloat32Arraypositiveglobalsideformatbusyrm -frnumbervalidationarktypecall-bindeast-asian-widthnodejsinstallersesSymbolsetterphonepluginbinwhatwgrm -rfsetImmediatepruneECMAScript 2023TypeScriptpuregetOwnPropertyDescriptorcompilerrdssafeBigInt64ArrayUint8Arrayjson-schema-validatorHyBienvironmentsescapeminimalSymbol.toStringTagtypesafeframershellinternal slotcircularfast-deep-copybyteLengthchineseES2020regularjapanesevalidate256ES2022gdpra11ytraverseclassnamefilterassertdateio-tslengthcallrestfulstreamsenderlanguageupObservablebuffersfastcopymanagerparentsArray.prototype.includesenumerablechromiumfpcjkjoiObject.getPrototypeOfforEachregular-expressionrobustfasttoArrayformsoncees-shimswidthnegativeIteratorapiautoscalingdescriptorECMAScript 2021argumentsubprocess_.extendgettercode pointscssfunctionaljsdiffArray.prototype.containsaccessibilityshebangtoolkitcodesapptransformString.prototype.trimperformanceECMAScript 2017telephonestringifyArrayBuffer#slicekeysArray.prototype.filterstyleReflect.getPrototypeOfpicomatchES2021propertieses5byteOffsetmergematchAllredirectuser-streamseventDispatcherdataViewlrurangeerrordependency managerESnextsome[[Prototype]]bindjson-schema-validationlocalECMAScript 5identifiersnopeyupbeanstalkcloudsearchsetnamesmruPromiseInt8ArrayURLfigletsymbolsES5searchconfigloading@@toStringTagreact animationexpressObject.isglacierserializespringagentprivate datavarECMAScript 2019colorlasttacittapoptimizerparsevalueswritableCSScurriedJSONtypeerrordeepcopyECMAScript 2015transpilerreducerfindupi18nwaapisymbolroutinges6immutableStreamES2015jssuperstructes2016reducermdirfullFloat64Arrayutilsvalidatorconstignorespecrandomoptionmomentbabel-corergbsource mapObjectpackagescallboundtslibkeyec2dropeslint.gitignorewalkingprocessgroup__proto__package managerstableresolveeveryrssTypedArrayRegExp.prototype.flagscontainsgetoptwriteconsoleterminalxmlArray.prototype.findLastIndextoolsmatchReactiveXpnpm9colorschromewindowmkdirpmochaawesomesauceintrinsicbinariesArray.prototype.flatMapdom
6.8.107

10 months ago

6.8.106

10 months ago

6.8.105

10 months ago

6.8.104

10 months ago

6.8.103

10 months ago

6.8.102

10 months ago

6.7.102

10 months ago

5.7.102

10 months ago

5.7.101

10 months ago

5.6.101

10 months ago

5.6.100

10 months ago

5.6.99

10 months ago

5.6.98

10 months ago

5.6.97

10 months ago

5.6.96

10 months ago

5.6.95

10 months ago

5.6.94

10 months ago

5.6.93

10 months ago

5.6.92

11 months ago

4.6.92

11 months ago

4.6.91

11 months ago

4.6.90

11 months ago

4.6.89

11 months ago

4.6.88

11 months ago

4.6.87

11 months ago

4.6.86

11 months ago

4.6.85

11 months ago

4.6.84

11 months ago

4.6.83

11 months ago

4.6.82

11 months ago

4.6.81

11 months ago

4.6.80

11 months ago

4.6.79

11 months ago

4.6.78

11 months ago

4.6.77

11 months ago

4.6.76

11 months ago

4.6.75

11 months ago

4.6.74

11 months ago

4.6.73

11 months ago

4.6.72

11 months ago

4.6.71

11 months ago

4.6.70

11 months ago

4.6.69

11 months ago

4.6.68

11 months ago

4.6.67

11 months ago

4.6.66

11 months ago

4.5.66

11 months ago

3.5.66

11 months ago

3.5.65

12 months ago

3.5.64

12 months ago

3.5.63

12 months ago

3.5.62

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

2.5.53

12 months ago

2.5.52

12 months ago

2.5.51

12 months ago

2.5.50

12 months ago

2.5.49

12 months ago

2.5.48

12 months ago

2.5.47

12 months ago

2.5.46

1 year ago

2.5.45

1 year ago

2.5.44

1 year ago

2.5.43

1 year ago

2.5.42

1 year ago

2.5.41

1 year ago

2.5.40

1 year ago

2.5.39

1 year ago

2.5.38

1 year ago

2.5.37

1 year ago

2.5.36

1 year ago

2.5.35

1 year ago

2.5.34

1 year ago

2.5.33

1 year ago

2.5.32

1 year ago

1.5.32

1 year ago

1.5.31

1 year ago

1.5.30

1 year ago

1.5.29

1 year ago

1.5.28

1 year ago

1.5.27

1 year ago

1.5.26

1 year ago

1.5.25

1 year ago

1.5.24

1 year ago

1.5.23

1 year ago

1.5.22

1 year ago

1.5.21

1 year ago

1.5.20

1 year ago

1.5.19

1 year ago

1.5.18

1 year ago

1.5.17

1 year ago

1.5.16

1 year ago

1.5.15

1 year ago

1.5.14

1 year ago

1.5.13

1 year ago

1.5.12

1 year ago

1.5.11

1 year ago

1.5.10

1 year ago

1.4.10

1 year ago

1.4.9

1 year ago

1.4.8

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

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