Skip to content

Instantly share code, notes, and snippets.

@frederikprijck frederikprijck/With Angular Secret

Created Jan 24, 2017
Embed
What would you like to do?
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');
});
});
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
You can’t perform that action at this time.