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

100% Statements 8/8
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 251x 10x 10x 10x 20x 10x   10x                                  
export const createPlaylist = (name, contentItems, folderId, playlistResolutionItem, relatedContents) => {
    const {text, orientation} = playlistResolutionItem;
    let width = text.split('x')[0];
    let height = text.split('x')[1];
    let totalDurationSeconds = contentItems.reduce((accumulate, {durationSeconds}) => accumulate + durationSeconds, 0);
    let playlistThumbnailUrls = contentItems[0].contents.thumbnailUrls;
 
    return {
        name,
        metaData: {
            durationSeconds: totalDurationSeconds,
            contentItems,
            display: {
                resolution: {
                    width, height
                },
                orientation
            },
        },
        relatedContents,
        thumbnailUrls: playlistThumbnailUrls,
        folderId,
        tags: [],
    }
};