Created
July 12, 2019 12:26
This file contains 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('TempUserService', () => { | |
it('when we call read without a temp user in there should read null', () => { | |
// arrange | |
const c = setup().build(); | |
// act | |
const result = c.readEmail(); | |
// assert | |
expect(result == null).toBe(true); | |
}); | |
}); | |
function setup() { | |
// the autospy VVVVV will create an object with the methods of the class mocked | |
const localStorage = autoSpy(Storage); | |
const builder = { | |
localStorage, | |
build() { | |
return new TempUserService(localStorage); | |
}, | |
}; | |
return builder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment