All files / nexshop-web-contents/spec/model-factory playlist-spec.js

100% Statements 24/24
100% Branches 0/0
100% Functions 9/9
100% Lines 24/24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x 1x   1x 1x       1x 1x       1x 7x     1x 1x     1x 1x     1x 1x     1x 1x                 1x 1x     1x 1x     1x 1x    
import React from 'react';
import {expect} from 'chai';
import {createPlaylist} from "../../src/model-factory/playlist";
import {contentItemModel} from "nexshop-web-store";
 
describe('Playlist Spec', () => {
    const contentItems = Object.freeze([
        contentItemModel.createContentItem({thumbnailUrls: {thumbnail: 'some nail'}}, 5),
        contentItemModel.createContentItem('contentItem2', 30)]
    );
    const resolution = Object.freeze({value: 'HD', text: '1280x720', orientation: 'vertical'});
    const relatedContents = [ { id: '3' }, { id: '2' }, { id: '1' } ];
    let subject;
 
 
    beforeEach(() => {
        subject = createPlaylist('this is playlist name', contentItems, 'folder id', resolution, relatedContents);
    });
 
    it('sets name with given name', () => {
        expect(subject.name).to.equal('this is playlist name');
    });
 
    it('sets folderId with givne folderId', () => {
        expect(subject.folderId).to.equal('folder id');
    });
 
    it('sets contentItems with given contentItems', () => {
        expect(subject.metaData.contentItems).to.equal(contentItems);
    });
 
    it('sets display with given resolution', () => {
        expect(subject.metaData.display).to.deep.equal({
            resolution: {
                width: '1280',
                height: '720'
            },
            orientation: 'vertical'
        })
    });
 
    it('sets durationSeconds with total duration seconds of given contentItems', () => {
        expect(subject.metaData.durationSeconds).to.equal(35);
    });
 
    it("sets thumbnailUrls with first contentItem's thumbnail", () => {
        expect(subject.thumbnailUrls).to.deep.equal({thumbnail: 'some nail'})
    });
 
    it("sets relatedContents", () => {
        expect(subject.relatedContents).to.deep.equal(relatedContents);
    });
});