The best way to fake uuid.v4
Author: hellboy81Created Nov 9, 2015Updated Dec 20, 2023
In SUT is v4 method uuid used:
uuid = require('uuid')
uuid.v4()
'b14b1abb-180e-4d34-a59c-940bc2e77ac7'What is the best way fake their returning value in Arrange phase?
// How should we replace 'b14b1abb-180e-4d34-a59c-940bc2e77ac7'
// Can I simply use chance.guid?
uuid = {v4: sandbox.stub().named('uuid.v4').returns(...)}Source: chancejs/chancejs