{"_id":"moxios","_rev":"11-006efca6d630ed16d4d9207b2ac2a8db","name":"moxios","description":"Mock axios requests for testing","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"moxios","version":"0.1.0","description":"Mock axios requests for testing","main":"index.js","scripts":{"test":"karma start --single-run","build":"./scripts/build","preversion":"npm test","version":"npm run build && git add -A dist/","postversion":"git push && git push --tags"},"files":["build/"],"repository":{"type":"git","url":"git+https://github.com/mzabriskie/moxios.git"},"keywords":["axios","test","testing","mock","mocking"],"author":{"name":"Matt Zabriskie"},"license":"MIT","bugs":{"url":"https://github.com/mzabriskie/moxios/issues"},"homepage":"https://github.com/mzabriskie/moxios#readme","devDependencies":{"axios":"^0.11.1","babel":"^6.5.2","babel-cli":"^6.9.0","babel-core":"^6.9.0","babel-loader":"^6.2.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","karma":"^0.13.22","karma-cli":"^1.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.0.1","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","lolex":"^1.5.0","mocha":"^2.5.3","sinon":"^1.17.4","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"gitHead":"71e651ecd5790c33eed346dc56e7eea8beabc0ae","_id":"moxios@0.1.0","_shasum":"f7818287476745b99298b62c308f1e6992ad55ff","_from":".","_npmVersion":"2.14.3","_nodeVersion":"3.3.1","_npmUser":{"name":"mzabriskie","email":"mzabriskie@gmail.com"},"maintainers":[{"name":"mzabriskie","email":"mzabriskie@gmail.com"}],"dist":{"shasum":"f7818287476745b99298b62c308f1e6992ad55ff","tarball":"https://registry.npmjs.org/moxios/-/moxios-0.1.0.tgz","integrity":"sha512-X6rer6yUl97CeWbsto4eaPN0L+ClwgYcDxi+xhLe7A+DdVp85VTQ/3DbJnJATOEltLyjWcGfzecAYVWFD371Eg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICGED13P8vu3c2i6u4ViHUplXS7c+k2naCXz4LA4t4JyAiEA4g1GKu281mIYaGck8lhVzopBiwdAUQ+qdGfNjKxk/iU="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/moxios-0.1.0.tgz_1464382459201_0.9223097034264356"},"directories":{}},"0.2.0":{"name":"moxios","version":"0.2.0","description":"Mock axios requests for testing","main":"dist/moxios.js","scripts":{"test":"karma start --single-run","build":"webpack && MINIFY=1 webpack","preversion":"npm test","version":"npm run build && git add -A dist/","postversion":"git push && git push --tags"},"files":["dist/","README.md"],"repository":{"type":"git","url":"git+https://github.com/mzabriskie/moxios.git"},"keywords":["axios","test","testing","mock","mocking"],"author":{"name":"Matt Zabriskie"},"license":"MIT","bugs":{"url":"https://github.com/mzabriskie/moxios/issues"},"homepage":"https://github.com/mzabriskie/moxios#readme","peerDependencies":{"axios":">= 0.9.0"},"devDependencies":{"babel-cli":"^6.9.0","babel-core":"^6.9.0","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","karma":"^0.13.22","karma-cli":"^1.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.0.1","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","lolex":"^1.5.0","mocha":"^2.5.3","sinon":"^1.17.4","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"gitHead":"3759ba184804bab4c21f2a58cd2710327bd2ed3c","_id":"moxios@0.2.0","_shasum":"906635326304aeb479a413a4e5bc7df9b1755118","_from":".","_npmVersion":"2.14.3","_nodeVersion":"3.3.1","_npmUser":{"name":"mzabriskie","email":"mzabriskie@gmail.com"},"maintainers":[{"name":"mzabriskie","email":"mzabriskie@gmail.com"}],"dist":{"shasum":"906635326304aeb479a413a4e5bc7df9b1755118","tarball":"https://registry.npmjs.org/moxios/-/moxios-0.2.0.tgz","integrity":"sha512-mPvsBrOP96clQd/i+ymCb4aHxcTBXvO/EBKFtTuWJmrfjc7dPl0T27XgMhNlszlskUatyMz6WnPFWcjSVh1z0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE4x47oNCsPG+diksSO4osSfcQjBubSWSd+k+TmJ4haSAiEAjdmUyWpu2WJ3JjbMiiXUQzZyzi4+4ZQC3mVJx+q0kuA="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/moxios-0.2.0.tgz_1464409278283_0.9421657281927764"},"directories":{}},"0.3.0":{"name":"moxios","version":"0.3.0","description":"Mock axios requests for testing","main":"dist/moxios.js","scripts":{"test":"karma start --single-run","build":"webpack && MINIFY=1 webpack","preversion":"npm test","version":"npm run build && git add -A dist/","postversion":"git push && git push --tags"},"files":["dist/","README.md"],"repository":{"type":"git","url":"git+https://github.com/mzabriskie/moxios.git"},"keywords":["axios","test","testing","mock","mocking"],"author":{"name":"Matt Zabriskie"},"license":"MIT","bugs":{"url":"https://github.com/mzabriskie/moxios/issues"},"homepage":"https://github.com/mzabriskie/moxios#readme","peerDependencies":{"axios":">= 0.13.0"},"devDependencies":{"axios":"^0.13.0","babel-cli":"^6.9.0","babel-core":"^6.9.0","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","karma":"^0.13.22","karma-cli":"^1.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.0.1","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","lolex":"^1.5.0","mocha":"^2.5.3","sinon":"^1.17.4","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"gitHead":"8efab10affaa1d6f46ade94b58e48a2a35993fee","_id":"moxios@0.3.0","_shasum":"5cfe89cbe3b513a41d09f4fe6bdb6bfe362c8b3a","_from":".","_npmVersion":"3.9.5","_nodeVersion":"3.3.1","_npmUser":{"name":"mzabriskie","email":"mzabriskie@gmail.com"},"maintainers":[{"name":"mzabriskie","email":"mzabriskie@gmail.com"}],"dist":{"shasum":"5cfe89cbe3b513a41d09f4fe6bdb6bfe362c8b3a","tarball":"https://registry.npmjs.org/moxios/-/moxios-0.3.0.tgz","integrity":"sha512-rOCOMQ8HOVg0mcq2tJEa+i8cxBCXmA4c5kMNErsG7gFLTnSoLbZ1vRg3+gUBYk8iEqmS+Dp3qfsTZRbLLDjjYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrY1lb8W0sh4kehqOH0/NFS1xJdndPTWbW6bD8Sky6GwIhALUNf/T/PAp4zHIC1aiyFgc3ZuYthzhApa5NGDYV57fJ"}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/moxios-0.3.0.tgz_1468439733576_0.4163254164159298"},"directories":{}},"0.4.0":{"name":"moxios","version":"0.4.0","description":"Mock axios requests for testing","main":"dist/moxios.js","scripts":{"test":"karma start --single-run","build":"webpack && MINIFY=1 webpack","preversion":"npm test","version":"npm run build && git add -A dist/","postversion":"git push && git push --tags"},"files":["dist/","README.md"],"repository":{"type":"git","url":"git+https://github.com/mzabriskie/moxios.git"},"keywords":["axios","test","testing","mock","mocking"],"author":{"name":"Matt Zabriskie"},"license":"MIT","bugs":{"url":"https://github.com/mzabriskie/moxios/issues"},"homepage":"https://github.com/mzabriskie/moxios#readme","peerDependencies":{"axios":">= 0.13.0"},"devDependencies":{"axios":"^0.13.0","babel-cli":"^6.9.0","babel-core":"^6.9.0","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","karma":"^0.13.22","karma-cli":"^1.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.0.1","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","lolex":"^1.5.0","mocha":"^2.5.3","sinon":"^1.17.4","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"gitHead":"62101e4a7c49fbf5b639ed5d36587f2b4941c6a2","_id":"moxios@0.4.0","_shasum":"fc0da2c65477d725ca6b9679d58370ed0c52f53b","_from":".","_npmVersion":"3.9.5","_nodeVersion":"3.3.1","_npmUser":{"name":"mzabriskie","email":"mzabriskie@gmail.com"},"maintainers":[{"name":"mzabriskie","email":"mzabriskie@gmail.com"}],"dist":{"shasum":"fc0da2c65477d725ca6b9679d58370ed0c52f53b","tarball":"https://registry.npmjs.org/moxios/-/moxios-0.4.0.tgz","integrity":"sha512-r+7DOsTcoTAwY6TGIDtjeTEBXMW8aGgk74MfASOC1tgYXD8Kq+cnqQHUdMnvfjf/CK7Pg/Wo52ohqy5zlyv9XQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAwt0N76q5BzmtRNu8tF55pokxeMnuON773BGBqvBOygIgFW8+KVgrL8aBkHZDoInRK9JngIzpyF2nStMC6fUmdiI="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/moxios-0.4.0.tgz_1491335320836_0.23592673963867128"},"directories":{}}},"readme":"# moxios [![build status](https://img.shields.io/travis/mzabriskie/moxios.svg?style=flat-square)](https://travis-ci.org/mzabriskie/moxios)\n\nMock [axios](https://github.com/mzabriskie/axios) requests for testing\n\n## Installing\n\n```bash\n$ npm install moxios --save-dev\n```\n\n## Example\n\n```js\nimport axios from 'axios'\nimport moxios from 'moxios'\nimport sinon from 'sinon'\nimport { equal } from 'assert'\n\ndescribe('mocking axios requests', function () {\n\n  describe('across entire suite', function () {\n\n    beforeEach(function () {\n      // import and pass your custom axios instance to this method\n      moxios.install()\n    })\n\n    afterEach(function () {\n      // import and pass your custom axios instance to this method\n      moxios.uninstall()\n    })\n\n    it('specify response for a specific request', function (done) {\n      let input = document.querySelector('.UserList__Filter__Input')\n      let button = document.querySelector('.UserList__Filter__Button')\n\n      input.value = 'flintstone'\n      button.click()\n\n      // Elsewhere in your code axios.get('/users/search', { params: { q: 'flintstone' } }) is called\n\n      moxios.wait(function () {\n        let request = moxios.requests.mostRecent()\n        request.respondWith({\n          status: 200,\n          response: [\n            { id: 1, firstName: 'Fred', lastName: 'Flintstone' },\n            { id: 2, firstName: 'Wilma', lastName: 'Flintstone' }\n          ]\n        }).then(function () {\n          let list = document.querySelector('.UserList__Data')\n          equal(list.rows.length, 2)\n          equal(list.rows[0].cells[0].innerHTML, 'Fred')\n          equal(list.rows[1].cells[0].innerHTML, 'Wilma')\n          done()\n        })\n      })\n    })\n\n    it('stub response for any matching request URL', function (done) {\n      // Match against an exact URL value\n      moxios.stubRequest('/say/hello', {\n        status: 200,\n        responseText: 'hello'\n      })\n\n      // Alternatively URL can be a RegExp\n      moxios.stubRequest(/say.*/, {/* ... */})\n\n      let onFulfilled = sinon.spy()\n      axios.get('/say/hello').then(onFulfilled)\n\n      moxios.wait(function () {\n        equal(onFulfilled.getCall(0).args[0].data, 'hello')\n        done()\n      })\n    })\n\n  })\n\n  it('just for a single spec', function (done) {\n    moxios.withMock(function () {\n      let onFulfilled = sinon.spy()\n      axios.get('/users/12345').then(onFulfilled)\n\n      moxios.wait(function () {\n        let request = moxios.requests.mostRecent()\n        request.respondWith({\n          status: 200,\n          response: {\n            id: 12345, firstName: 'Fred', lastName: 'Flintstone'\n          }\n        }).then(function () {\n          equal(onFulfilled.called, true)\n          done()\n        })\n      })\n    })\n  })\n\n})\n```\n\n## Thanks\n\nmoxios is heavily inspired by [jasmine-ajax](https://github.com/jasmine/jasmine-ajax)\n\n## License\n\nMIT\n","maintainers":[{"name":"mzabriskie","email":"mzabriskie@gmail.com"}],"time":{"modified":"2022-06-20T10:37:41.524Z","created":"2016-05-27T20:54:21.830Z","0.1.0":"2016-05-27T20:54:21.830Z","0.2.0":"2016-05-28T04:21:21.567Z","0.3.0":"2016-07-13T19:55:37.071Z","0.4.0":"2017-04-04T19:48:41.581Z"},"homepage":"https://github.com/mzabriskie/moxios#readme","keywords":["axios","test","testing","mock","mocking"],"repository":{"type":"git","url":"git+https://github.com/mzabriskie/moxios.git"},"author":{"name":"Matt Zabriskie"},"bugs":{"url":"https://github.com/mzabriskie/moxios/issues"},"license":"MIT","readmeFilename":"README.md","users":{"oleg_tsyba":true,"vparaskevas":true,"cameronnokes":true,"juanf03":true}}