All Projects → wechaty → puppet-mock

wechaty / puppet-mock

Licence: Apache-2.0 license
Puppet Mocker for Wechaty (& A Puppet Template Starter)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to puppet-mock

Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+10348.48%)
Mutual labels:  mock
python-wechaty-getting-started
Python Wechaty Starter Project Template that Works Out-of-the-Box
Stars: ✭ 140 (+324.24%)
Mutual labels:  wechaty
mocka
Mocka - The complete testing framework for LUA and Nginx
Stars: ✭ 26 (-21.21%)
Mutual labels:  mock
Vuex Mock Store
✅Simple and straightforward Vuex Store mock for vue-test-utils
Stars: ✭ 246 (+645.45%)
Mutual labels:  mock
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (+666.67%)
Mutual labels:  mock
openman
Postman to OpenAPI Spec converter with mocking and documentation
Stars: ✭ 17 (-48.48%)
Mutual labels:  mock
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (+600%)
Mutual labels:  mock
graphql-mock-api
A GraphQL mock to any GraphQL schema
Stars: ✭ 28 (-15.15%)
Mutual labels:  mock
Vue Element Admin
🎉 A magical vue admin https://panjiachen.github.io/vue-element-admin
Stars: ✭ 73,044 (+221245.45%)
Mutual labels:  mock
HttpClientMock
Library for mocking Apache HttpClient.
Stars: ✭ 41 (+24.24%)
Mutual labels:  mock
Jest Localstorage Mock
A module to mock window.localStorage and window.sessionStorage in Jest
Stars: ✭ 247 (+648.48%)
Mutual labels:  mock
Mujina
A mock IDP and SP using the OpenSAML library
Stars: ✭ 250 (+657.58%)
Mutual labels:  mock
DataAbstractions.Dapper
A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection.
Stars: ✭ 37 (+12.12%)
Mutual labels:  mock
Shallow Render
Angular testing made easy with shallow rendering and easy mocking. https://getsaf.github.io/shallow-render
Stars: ✭ 242 (+633.33%)
Mutual labels:  mock
aem-stubs
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.
Stars: ✭ 40 (+21.21%)
Mutual labels:  mock
Faker
Provides fake data to your Android apps :)
Stars: ✭ 234 (+609.09%)
Mutual labels:  mock
go-github-mock
A library to aid unittesting code that uses Golang's Github SDK
Stars: ✭ 63 (+90.91%)
Mutual labels:  mock
fe-dev-server
FE Dev Server target to help frontend web developers create view template, styles and js easily.
Stars: ✭ 30 (-9.09%)
Mutual labels:  mock
walletconnect-test-wallet
Test Wallet (Web)
Stars: ✭ 163 (+393.94%)
Mutual labels:  mock
xrm-mock-generator
📖  Generates a mock Xrm.Page object. Commonly used by xrm-mock to test Dynamics 365 client-side customisations.
Stars: ✭ 15 (-54.55%)
Mutual labels:  mock

PUPPET-MOCK

NPM Version npm (tag) NPM ES Modules

chatie puppet

Picture Credit: https://softwareautotools.com/2017/03/01/mocking-explained-in-python/

Powered by Wechaty TypeScript

Puppet Mocker & Starter Template for Wechaty, it is very useful when you:

  1. Want to test the Wechaty framework with a mock puppet, or
  2. You want to write your own Puppet implenmentation.

Then PuppetMock will helps you a lot.

USAGE

Puppet Mock

import { Wechaty }   from 'wechaty'
import { PuppetMock } from 'wechaty-puppet-mock'

const puppet  = new PuppetMock()
const wechaty = new Wechaty({ puppet })

wechaty.start()

Mocker & Environment

import {
  PuppetMock,
  Mocker,
  SimpleEnvironment,
}                     from 'wechaty-puppet-mock'

const mocker = new Mocker()
mocker.use(SimpleEnvironment())

const puppet = new PuppetMock({ mocker })
const wechaty = new Wechaty({ puppet })

wechaty.start()

// The Mocker will start perform the SimpleEnvironment...

See: SimpleEnvironment

API Reference

Mocker

import { Wechaty }  from 'wechaty'
import { PuppetMock, mock }   from 'wechaty-puppet-mock'

const mocker = new mock.Mocker()
const puppet = new PuppetMock({ mocker })
const bot = new Wechaty({ puppet })

await bot.start()

mocker.scan('https://github.com/wechaty', 1)

const user = mocker.createContact()
mocker.login(user)

const contact = mocker.createContact()
const room = mocker.createRoom()

user.say('Hello').to(contact)
contact.say('World').to(user)

HELPER UTILITIES

StateSwitch

this.state.on('pending')
this.state.on(true)
this.state.off('pending')
this.state.off(true)

await this.state.ready('on')
await this.state.ready('off')

Watchdog

MemoryCard

await memory.set('config', { id: 1, key: 'xxx' })
const config = await memory.get('config')
console.log(config)
// Output: { id: 1, key: 'xxx' }

HISTORY

master v1.18 (Mar 14, 2022)

Upgrade to Wechaty Puppet v1.18

v1.0 (Oct 29, 2021)

Release v1.0 of Puppet Mock

  1. v0.31: Support ES Modules

v0.25 (July 13, 2020)

  1. Rename MockXXX to XXXMock for keep the consistent naming style with PuppetMock.
  2. Export mock namespace and move all related modules under it.

v0.22 (June 4, 2020)

Mocker Released. Mocker is a manager for controlling the behavior of the Puppet activities.

  1. Add MockContact, MockRoom, and MockMessage for Mockers
  2. Add MockEnvironment for mocking the server behaviors.
  3. Support Wechaty#Contact.find() from the mocker.createContacts()
  4. Support Wechaty#Room.find() from the mocker.createRooms()
  5. Support message event for talker, listener, and room of MockMessage

v0.0.1 (Jun 27, 2018)

Initial version.

PuppetMock is a skelton Puppet without do anything, it will make testing easy when developing Wechaty

AUTHOR

Huan LI <[email protected]>

profile for zixia on Stack Exchange, a network of free, community-driven Q&A sites

COPYRIGHT & LICENSE

  • Code & Docs © 2018 Huan LI <[email protected]>
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].