+{"_id":"chai-kekka","_rev":"1-646caea441dac0afda374a6f05f9329e","name":"chai-kekka","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"chai-kekka","version":"0.0.1","description":"Chai plugin for Kekka","repository":{"type":"git","url":"git+https://github.com/apemb/chai-kekka.git"},"homepage":"https://github.com/apemb/chai-kekka","main":"index.js","scripts":{"lint":"eslint src/**.js test/**.js --fix","test":"mocha --recursive --exit"},"keywords":["chai","test","chai-plugin","Result","Monad"],"author":{"name":"Antoine Boileau"},"license":"ISC","dependencies":{"kekka":"^1.0.0","chai":"^4.2.0"},"devDependencies":{"chai-as-promised":"^7.1.1","eslint":"^7.15.0","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","mocha":"^8.2.1"},"gitHead":"835af5f306af64c8887348ae478607733aab616f","bugs":{"url":"https://github.com/apemb/chai-kekka/issues"},"_id":"chai-kekka@0.0.1","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-UIkFA9+EPFSYT198yL6zq3snphHco13f8OJrWRkJ+XO7l87lkXmB9ljmcIx+H64Gq3DuGBOR/Eiw0OQbQcOUtw==","shasum":"66a63cf3c8c4f6b83c93ed802e0173b1b1433bd1","tarball":"https://registry.npmjs.org/chai-kekka/-/chai-kekka-0.0.1.tgz","fileCount":17,"unpackedSize":22342,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9c7GCRA9TVsSAnZWagAAFssP/i4Yk8iHIk6O/cTlXtjR\nPAVJ8n2IZJAgPFl3yKAxGTXY8kc9qS8c74wiSgK9vaLIcQrxeIAaFVMbQ8zF\nLavxeThhYYhAM9su5AYzFnuzPbqjKOleef2fEPTN+hVCESi2nydkf/FI1yHS\nH/MghM4WVFKVaX5Fqj9w8iUj7MS5S0a40NjSFhYCCJRg4neZQF7Rc2NXOgVg\n6XvSFmnsBncFB+5s/RrJ1U2xYDgKyymJZ8XBPuNp1Nt9U015gKsH1cH1eEar\nhm46ccOBYlZRXaoEYHzvc8D84X2w2EcNWqNqPx07ut7nagAIeLVJTt2OYu/T\n4A6zgqnEpqRhxpAUZoWhQ1d4vz3v+LzmRDZH0NxBxGdJlhckf4BpG4m7merA\nR4yqbYLsNtbjHLJwRzy4Zq//EAbbfE9nmz1rXv0lIczmp1hWug3Zqnfy8oeC\n7XgGS7No5vsArLIVaW4djuhv4+obKhc0yX0hxpTsDB5dIGJsbBJLPqrWwibJ\nNwovYLMcx13yVfi8Alo28HCDW20cM5PSc77Mwddz67jXfNrYQ3BtuC1GxEuc\nMuzolAD3hAVBs2RZ6kaeX7qqMdyLWgZeHg9pp8D6x6loys7mHNbXIiV06FTU\nkOoLs/JeVzyed5gisX0CNTaeOtyBbSe2WQuoFxxoSbeXPJCthACJXt1jfoYo\nKhG6\r\n=ScUt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"apemb","email":"apem.boileau@gmail.com"},"directories":{},"maintainers":[{"name":"apemb","email":"apem.boileau@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chai-kekka_0.0.1_1609944774138_0.10193912416044659"},"_hasShrinkwrap":false},"1.0.0":{"name":"chai-kekka","version":"1.0.0","description":"Chai plugin for Kekka","repository":{"type":"git","url":"git+https://github.com/apemb/chai-kekka.git"},"homepage":"https://github.com/apemb/chai-kekka","main":"index.js","scripts":{"lint":"eslint src/**.js test/**.js --fix","test":"mocha --recursive --exit"},"keywords":["chai","test","chai-plugin","Result","Monad"],"author":{"name":"Antoine Boileau"},"license":"ISC","dependencies":{"kekka":"^1.0.0","chai":"^4.2.0"},"devDependencies":{"chai-as-promised":"^7.1.1","eslint":"^7.15.0","eslint-config-standard":"^16.0.2","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","mocha":"^8.2.1"},"gitHead":"18d944dd47104384c70e43d3b629bdecbaff2211","bugs":{"url":"https://github.com/apemb/chai-kekka/issues"},"_id":"chai-kekka@1.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Vrkdg3myIo9/BbFA+BO9xPwu74I+FkNH4JBEjgZZ3scyBFIjtkBuBnabO6a6Uh6ehG/MDzYIlcJe6vu0986W0Q==","shasum":"9949f1724089a2efd1673cc0806cc84425055eb1","tarball":"https://registry.npmjs.org/chai-kekka/-/chai-kekka-1.0.0.tgz","fileCount":17,"unpackedSize":25292,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9eCRCRA9TVsSAnZWagAA1LkP/jTAN8AZ8bwe2D2hCD9p\nl15KO5yfMLBPepu6UUO1T7gegkfK5qsa0VxOqNzD+53bnheI/ctJ285KZAdH\nLdte9R3h2aEX+y77mBK2Ln6A4gDpbF6XqI/QAv1VQE3wOtOwVDc4yPZw4wmi\nNj+fc5g+4dTTpY6XptcjI+2LMDRLbw69fOyw5wbMbVvN9A4DenlxRsSZHvvW\nIO8qvsB8xObN7pezA3T/GgRw4iHDFZxbnoRw8uzM53FW1wE/U3lgcWbSqSh4\nq+/d7YCWFaPCvqOJVGJ+bVAgvpU8HnI9wtxLO/93SUux2dLijylhWb/mcEXh\nOyOx03IPo/Fm9u84+kYlgHUOShgL29G5/m6RJxd/TDQck4zjuxT+yKJlHpA/\ndlSkpSlFZh1Ml131PHutPxUyYLjrnTqYmlU60K72WN2XQu72PlYQZoGw0Znf\nVp4VxzcKn9K2wRRPxqVFOHkeqWeYx2z1NAEUDXqUw96WkWQntqEZr5TSCIuZ\nveWatFc16yiIzI+cGHDKh9dcjYcv+jooIge1VP6GmHzmy+15CyhNjGBjOGdE\nRMFi8y8ctWtqHFv0TcMyimyzU1sxloBJqHoTvckvK6ewtG2+eoAdBeDn50yP\n1UYr8lw4/0UhSbFtdrun4m0CdfKtYWk0lbOdudfj5E1LX8+GAzMu5UKCK1yg\nHe6c\r\n=9fV0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"apemb","email":"apem.boileau@gmail.com"},"directories":{},"maintainers":[{"name":"apemb","email":"apem.boileau@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chai-kekka_1.0.0_1609949329394_0.30826242482043353"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-06T14:52:54.137Z","0.0.1":"2021-01-06T14:52:54.245Z","modified":"2021-01-06T16:08:51.855Z","1.0.0":"2021-01-06T16:08:49.591Z"},"maintainers":[{"name":"apemb","email":"apem.boileau@gmail.com"}],"description":"Chai plugin for Kekka","homepage":"https://github.com/apemb/chai-kekka","keywords":["chai","test","chai-plugin","Result","Monad"],"repository":{"type":"git","url":"git+https://github.com/apemb/chai-kekka.git"},"author":{"name":"Antoine Boileau"},"bugs":{"url":"https://github.com/apemb/chai-kekka/issues"},"license":"ISC","readme":"# Chai-Kekka\n\nA Chai plugin for [Kekka](https://github.com/apemb/kekka)\n\n## Installation and Usage\n\nNode: `npm install --save-dev chai-kekka` to get up and running.\n```js\nconst chai = require(\"chai\")\nconst chaiKekka = require(\"chai-kekka\")\n \nchai.use(chaiKekka)\n```\n\n## Documentation\n\n### Test value is a Type Result \nThe `result` property can be used to check that the tested value is an instance of the `Result` class. \n```js\nexpect(Success('Some String')).to.be.a.result\nexpect(Failure(new Error('Failure...'))).to.be.a.result\n```\n\n### Test value is a Result Success\n\nThe `success` property can be used to check that the tested value is an instance of the `Result` class of type `Success`.\n\n```js\n// Positive\nexpect(Success('Success String')).to.be.a.success // OK\nexpect(Failure(new Error('Failure...'))).to.be.a.success // FAIL\nexpect('Not a result').to.be.a.success // FAIL\n\n// Negative\nexpect(Success('Success String')).not.to.be.a.success // FAIL\nexpect(Failure(new Error('Failure...'))).not.to.be.a.success // OK\nexpect('Not a result').not.to.be.a.success // FAIL with 'expected 'Not a result' to be an instance of Result'\n```\n\n\n### Test value is a Result Failure\n\nThe `failure` property can be used to check that the tested value is an instance of the `Result` class of type `Failure`.\n\n```js\n// Positive\nexpect(Success('Success String')).to.be.a.failure // FAIL\nexpect(Failure(new Error('Failure...'))).to.be.a.failure // OK\nexpect('Not a result').to.be.a.failure // FAIL\n\n// Negative\nexpect(Success('Success String')).not.to.be.a.failure // OK\nexpect(Failure(new Error('Failure...'))).not.to.be.a.failure // FAIL\nexpect('Not a result').not.to.be.a.failure // FAIL with 'expected 'Not a result' to be an instance of Result'\n```\n\n### Test associated value of a Result Object\n\nThere are two ways to test the associated value of a Result object:\n - the methods `successWrapping` and `failureWrapping`\n - the property `associatedValue`\n\n#### `successWrapping` and `failureWrapping`\n```js\nconst error = new Error('Failure message')\nexpect(Failure(error)).to.be.a.failureWrapping(error) // OK\nexpect(Failure(error)).to.be.a.successWrapping(error) // FAIL - not a Success\nexpect(Failure(error)).to.be.a.failureWrapping('some other value') // FAIL\n\nexpect(Success('Success String')).to.be.a.successWrapping('Success String') // OK\nexpect(Success('Success String')).to.be.a.failureWrapping('Success String') // Fail - not a Failure\n\n// equality modifiers can be used, such as deep, on successWrapping and failureWrapping\nexpect(Success({ a: '423' })).to.be.a.deep.successWrapping({ a: '423' }) \n```\n\n#### `associatedValue`\n\nThe `associatedValue` property can be used after a `result`, `success` or `failure` property.\nIt changes the target of any assertions that follow in the chain to be on the result associated value.\n\n```js\nexpect(Success('Success String')).to.be.a.success\n .with.associatedValue.that.equals('Success String') // OK\nexpect(Success({ a: '423' })).to.be.a.success\n .with.associatedValue.that.deep.equals({ a: '423' }) // OK - equality modifiers accepted\nexpect(Success({ a: '423' })).to.be.a.failure\n .with.associatedValue.that.deep.equals({ a: '423' }) // FAIL - not a failure\nexpect(Success({ a: '423' })).to.be.a.result\n .with.associatedValue.that.deep.equals({ a: '423' }) // OK\nexpect(Success('Success String')).to.have.associatedValue.that.equals('Success String') // FAILS \n// associatedValue must be after either a result, success or failure assertion property\n```\n\n","readmeFilename":"README.md"}
0 commit comments