Skip to content

Todd Halfpenny

Code is Purgatory

  • Home
  • About
  • Blog
  • Speaking
  • 3 Pointers

Category: JavaScript

Posted on September 4, 2017September 4, 2017

Sinon – Checking if a function has been stubbed

Just a quick post here, in reference to using Sinon.jS, and checking whether or not a function has been stubbed.

Let’s say that you might have stubbed a function like this;

var foo = sinon.stub(jQuery, "ajax");

You can check to see if it’s been stubbed already, with this;

if ( jQuery.ajax.displayName === "ajax" ) { ... }

 

 

Recent Posts

  • Creating Salesforce Preview Release Scratch Orgs – Error VR-0003
  • Ionic ion-accordion with Custom ion-icon
  • The Salesforce Feature Release Flow, and Developer Previews
  • First Contribution to the SFDX CLI
  • Salesforce Vidyard Video Playback

Recent Comments

  • Andy Engin Utkan on The Salesforce Feature Release Flow, and Developer Previews
  • Daniel Zeidler on Salesforce Vidyard Video Playback
  • todd on Lightning Web Components Specialist – Trouble getting the boatMap Component?
  • Dhruv on Lightning Web Components Specialist – Trouble getting the boatMap Component?
  • Jess Robinson on Lightning Web Components Specialist – Trouble getting the boatMap Component?

Tags

android Angular code comments CSS design dropbox eclipse emulator Erlang experiment family forceignore gardening goals Gravater j2me JavaScript lanyrd linux meetup mini cooper mobil mobile nodejs opinion performance personal photography plugin quick synergy ribbit salesforce SFDX sidebars small business solution speach-to-text style tech technology ubuntu update widgets wordpress

Categories

  • 1 Minute Wonder
  • android
  • Community
  • design
  • Erlang
  • Family
  • gardening
  • I Want
  • Ionic
  • JavaScript
  • linux
  • nodejs
  • opinion
  • Restoring my Mini Cooper
  • Salesforce
  • small business
  • technology
  • Uncategorized
  • wordpress
  • Twitter
  • GitHub
  • LinkedIn
  • CodePen
  • Instagram
  • WordPress.org
Proudly powered by WordPress