-
-
Save frederikprijck/caf5d407af0c40d2805951f4450e0ead to your computer and use it in GitHub Desktop.
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('Youtube api service', () => { | |
let service; | |
beforeEach(() => { | |
angular | |
.module('app', []) | |
.service('youtubeService', YoutubeService); | |
angular.mock.module('app'); | |
}); | |
beforeEach(angular.mock.inject((youtubeService) => { | |
service = youtubeService; | |
})); | |
it('should get an ID from long youtube link', () => { | |
let link = 'https://www.youtube.com/watch?v=TFeSNOdNtyo'; | |
let id = service.getId(link); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
it('should get an ID from short youtube link', () => { | |
let link = 'https://www.youtu.be/TFeSNOdNtyo'; | |
let id = service.getId(link); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
it('should get an ID from same ID', () => { | |
let inputID = 'TFeSNOdNtyo'; | |
let id = service.getId(inputID); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
}); |
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('Youtube api service', () => { | |
let service; | |
beforeEach(() => { | |
service = new YoutubeService(); | |
}); | |
it('should get an ID from long youtube link', () => { | |
let link = 'https://www.youtube.com/watch?v=TFeSNOdNtyo'; | |
let id = service.getId(link); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
it('should get an ID from short youtube link', () => { | |
let link = 'https://www.youtu.be/TFeSNOdNtyo'; | |
let id = service.getId(link); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
it('should get an ID from same ID', () => { | |
let inputID = 'TFeSNOdNtyo'; | |
let id = service.getId(inputID); | |
expect(id).toBe('TFeSNOdNtyo'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment