2024-09-28 07:54:36 -08:00
|
|
|
import { removeAlbumCommentsFromSongs } from './utils.js'
|
2021-04-24 17:40:55 -08:00
|
|
|
|
|
|
|
|
describe('removeAlbumCommentsFromSongs', () => {
|
|
|
|
|
const data = { 1: { comment: 'one' }, 2: { comment: 'two' } }
|
|
|
|
|
it('does not remove song comments if album does not have comment', () => {
|
|
|
|
|
const album = { comment: '' }
|
|
|
|
|
removeAlbumCommentsFromSongs({ album, data })
|
|
|
|
|
expect(data['1'].comment).toEqual('one')
|
|
|
|
|
expect(data['2'].comment).toEqual('two')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('removes song comments if album has comment', () => {
|
|
|
|
|
const album = { comment: 'test' }
|
|
|
|
|
removeAlbumCommentsFromSongs({ album, data })
|
|
|
|
|
expect(data['1'].comment).toEqual('')
|
|
|
|
|
expect(data['2'].comment).toEqual('')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('does not crash if album and data arr not available', () => {
|
|
|
|
|
expect(() => {
|
|
|
|
|
removeAlbumCommentsFromSongs({})
|
|
|
|
|
}).not.toThrow()
|
|
|
|
|
})
|
|
|
|
|
})
|