Created
          October 1, 2019 23:14 
        
      - 
      
- 
        Save joeskeen/d3f86024c82f9f8c3c91ebb78d277ce9 to your computer and use it in GitHub Desktop. 
    A sample spec demonstrating Arrange, Act, Assert
  
        
  
    
      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('PreferencesService', () => { | |
| describe('.getPreference', () => { | |
| it('should call getItem from LocalStorage', () => { | |
| // Arrange: initialize spy and test subject | |
| const getItemSpy = jasmine.createSpy('getItem'); | |
| const service = new PreferencesService({ getItem: getItemSpy } as LocalStorage); | |
| // Act: call getPreference | |
| service.getPreference('test key'); | |
| // Assert: make sure it called the spy | |
| expect(getItemSpy).toHaveBeenCalled(); | |
| }); | |
| }); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment