-
-
Save fearphage/aa512e0a04f1233ddf112740a850b0ba to your computer and use it in GitHub Desktop.
Example of stubbing a complex object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('something', function() { | |
beforeEach(function() { | |
this.getAttributeStub = sinon.stub(Xrm.Page, 'getAttribute'); | |
}); | |
afterEach(function() { | |
this.getAttributeStub.restore(); | |
}); | |
it('tests something', function() { | |
this.getAttributeStub.withArgs('name').returns({ | |
getValue: function() { return 'something'; } | |
}); | |
//test code here | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment