mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-13 12:23:34 +01:00
Set explicit flag from Audible match results
This commit is contained in:
1 parent
1e88ff01e7
commit
bf4f74cb93
2 files changed
+24
-1
No files matched your search
@@ -83,7 +83,8 @@ class Audible {
|
|||||||
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0,
|
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0,
|
||||||
region: item.region || null,
|
region: item.region || null,
|
||||||
rating: item.rating || null,
|
rating: item.rating || null,
|
||||||
abridged: formatType === 'abridged'
|
abridged: formatType === 'abridged',
|
||||||
|
explicit: !!item.isAdult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,4 +45,26 @@ describe('Audible', () => {
|
|||||||
expect(result).to.equal('.5')
|
expect(result).to.equal('.5')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('cleanResult', () => {
|
||||||
|
const baseItem = {
|
||||||
|
title: 'Some Book',
|
||||||
|
formatType: 'unabridged'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should set explicit to true when isAdult is true', () => {
|
||||||
|
const result = audible.cleanResult({ ...baseItem, isAdult: true })
|
||||||
|
expect(result.explicit).to.equal(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should set explicit to false when isAdult is false', () => {
|
||||||
|
const result = audible.cleanResult({ ...baseItem, isAdult: false })
|
||||||
|
expect(result.explicit).to.equal(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should set explicit to false when isAdult is not present', () => {
|
||||||
|
const result = audible.cleanResult({ ...baseItem })
|
||||||
|
expect(result.explicit).to.equal(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user