Questions tagged [spy]

A spy is XUnit pattern where you replace the original implementation with a test double to capture the calls on the object. Later in your test you can verify the object under test has made specific calls on that object

425 questions
7
votes
1 answer

Jest/React mock scrollBy and .getBoundingClientRect function

I have a function handleClick which uses scrollBy on an element which gets its first argument using getBoundingClientRect. I am trying to test this using jest/enzyme. class myClass extends Component { ... ... handleClick () { …
Mohammed
  • 555
  • 1
  • 6
  • 19
7
votes
1 answer

Testing FileSaver in Angular 5

I have imported file-saver in angular 5 application, when I am executing test cases it is giving following error: TypeError: FileSaver.saveAs is not a function Spec.ts: import FileSaver from 'file-saver'; .ts import FileSaver from…
Sreekanth Reddy
  • 483
  • 1
  • 6
  • 17
7
votes
0 answers

Mocking an environment in Angular with Jasmine

I'm still learning how to write tests for angular using Karma/Jasmine. I want to return false for the environment's isDebugMode. It works obviously when I change the code for it but how do I write a test for that? I have set up some tests trying…
classic89
  • 81
  • 1
  • 4
7
votes
3 answers

Capturing Win32 messages

Does anyone know a tool that can capture win32 messages that get sent to a particular process? I thought there was a tool from sysinternals for that but now I can't locate it. Anyone knows some?
Peter Krumins
  • 838
  • 1
  • 7
  • 24
7
votes
1 answer

Spy utility for Windows 8

I've used Snoop, it is the brilliant tool for WPF. SilverlightSpy has similar functionality for Silverlight and WP7. Does anybody know about any similar tools for Windows 8 projects? EDIT : I mean Windows Metro style applications on C#/XAML that run…
RredCat
  • 5,259
  • 5
  • 60
  • 100
6
votes
1 answer

How to properly spy on an input stream

My understanding is, that Mockito.spy(object) wraps a proxy around an existing object. This proxy delegates the method calls to the spied object and allows further verification (So it's different to a mock which provides no implementation). I want…
swaechter
  • 1,357
  • 3
  • 22
  • 46
6
votes
1 answer

Vue3- Using Vitest toHaveBeenCalled() method

I am running a vue3 application using the Composition API and the setup() hook. I am using Vitest as unit-test framework. (v 0.6.1) I have the following sample component : // src/components/MyComponent.vue