nexshop-web-contents
Version:
Nexshop Web Contents Project
53 lines (43 loc) • 1.83 kB
JavaScript
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);
});
});