expect(videoDetails.channel.name).to.equal('user_channel')
expect(videoDetails.support).to.equal('support')
expect(videoDetails.nsfw).to.be.true
+ expect(videoDetails.commentsEnabled).to.be.true
}
})
}
async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any) {
- const booleanAttributes: { [id: string]: boolean } = {}
+ const defaultBooleanAttributes = {
+ nsfw: false,
+ commentsEnabled: true,
+ downloadEnabled: true,
+ waitTranscoding: true
+ }
+
+ const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {}
- for (const key of [ 'nsfw', 'commentsEnabled', 'downloadEnabled', 'waitTranscoding' ]) {
+ for (const key of Object.keys(defaultBooleanAttributes)) {
if (command[ key ] !== undefined) {
booleanAttributes[key] = command[ key ]
} else if (defaultAttributes[key] !== undefined) {
booleanAttributes[key] = defaultAttributes[key]
} else {
- booleanAttributes[key] = false
+ booleanAttributes[key] = defaultBooleanAttributes[key]
}
}