0.1.5 • Published 4 years ago

webmock v0.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Webmock

yarn add webmock
var Webmock = require('webmock')
const { mock , app } = Webmock.express({
    port: 1219,
    static: __dirname,
    url: {
        data: {
            pass: {},
            fail: {msg: 'fail message'}
        }
    }
})
// mock.writeDoc(__dirname + '/doc.html')
mock.url('/news', {
    type: 'get',
    data: {
        pass: {
            'list|10': {
                title: '@ctitle'
            }
        },
        empty: {
            'list': []
        }
    }
})

mock.url('/login', {
    type: 'post',
    // JSON schema
    req: {
        user: {
            title: '用户名',
            example: 'nimo'
        },
        password: {
            title: '密码',
            example: 'abcddefg'
        }
    }
})
  • Webmock.express(props) default props is : ./lib/defaultProps.js
  • mock.url(settings) default settings is "./lib/defaultProps.js" url