The Wayback Machine - https://web.archive.org/web/20210815051318/https://github.com/topics/mock
Skip to content
#

mock

Here are 1,892 public repositories matching this topic...

ig3
ig3 commented Apr 22, 2020

Context

This isn't really a feature request, as what I need is possible with nock as-is. But I spent several hours searching, reading old issues and searching through the source code to find the solution, so I thought this might help others.

I am testing code that accesses a service that sets the statusMessage of the response, as well as the statusCode. I am using nock to mock the server

vue-admin-beautiful-pro

团结一心,共抗疫情,烟台加油!!!🚀🚀🚀vue3,vue3.0,vue,vue3.x,vue.js,vue后台管理,admin,vue-admin,vue-element-admin,ant-design,vue-admin-beautiful-pro,vab admin pro,vab admin plus主线版本基于element-plus、element-ui、ant-design-vue三者并行开发维护,同时支持电脑,手机,平板,切换分支查看不同的vue版本,element-plus版本已发布(vue3,vue3.0,vue,vue3.x,vue.js)程序无国界,但程序员有国界,中国国家尊严不容挑衅,如果您在特殊时期继续购买HM、耐克、阿迪达斯等品牌那么您将无权继续使用Vab
  • Updated Aug 10, 2021
  • Vue
msw
eddiemoore
eddiemoore commented Aug 10, 2021

Describe the bug

I'm using .on('request:match', (req) => {}) in tests to make sure variables are getting send correctly in the request, however is seems that if I have more than 1 across different tests then they start to fail. I have this in my setupTests file:

beforeAll(() => server.listen({ onUnhandledRequest: 'error' }))
afterAll(() => server.close())
afterEach(() => se
mockk
Kantis
Kantis commented Jun 2, 2021

Expected Behavior

Invoking a mockk should never cause a test to hang. If too many invocations lead to performance issues, it would be better to either:

  • throw an exception once a reasonable cap is reached
  • rotate away old data

Current Behavior

After invoking a mock around 130 000 times (on my machine, running JDK 15 on Windows) further invocations will hit a wall and take for

Mocky
moniuch
moniuch commented Apr 25, 2017

I would welcome a feature when, at the same url which is set to respond with OK status, I could have an error response generated with a random seed.

I am developing an Observable pattern to perform a series of retries to call an endpoint, with increasing delay. The problem is that during testing, I cannot really mock up the condition by randomly switching between two mocky.io urls (error and ok

pappe82
pappe82 commented Feb 24, 2021

A "normal" event on an instance ignores null subscriptions. If I do so on a substituted interface, a null subscription leads to an exception. I have a not so nice legacy code with different listeners to an event an one class that does null-attach internally under some conditions, would be nice if this behaviour would be able to be tested as well. Example code for the problem:

        publ
dbreese
dbreese commented Jul 14, 2021

Take this class, for example:

`
import Foundation

// some comment has import SOMEBADTHING
public protocol TestProtocol: AnyObject {
func doSomething() -> Void
}
`

The generated mock ends up having:

... import SOMEBADTHING ...

Looks like it is looking for "{import .*}" in source files and just adding that verbatim to the output file, causing compile issues.

Improve this page

Add a description, image, and links to the mock topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the mock topic, visit your repo's landing page and select "manage topics."

Learn more