Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sites/ontvtonight.com/ontvtonight.com.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ function parseStart($item, date, channel) {
}

function parseTitle($item) {
return $item.find('td:nth-child(2) > h5').text().trim()
return $item.find('td:nth-child(2) h5').text().trim()
}

function parseDescription($item) {
return $item.find('td:nth-child(2) > h6').text().trim()
return $item.find('td:nth-child(2) h6').text().trim()
}

function parseItems(content) {
Expand Down Expand Up @@ -255,4 +255,4 @@ async function fetchWafToken(content) {
cookies['aws-waf-token'] = awsWafToken
}
}
}
}
31 changes: 31 additions & 0 deletions sites/ontvtonight.com/ontvtonight.com.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,37 @@ it('can parse response', () => {
])
})

it('can parse nested title and description markup', () => {
const content = `
<table>
<tbody>
<tr>
<td><h5>8:30 pm</h5></td>
<td>
<div>
<h5><a href="#">The Princess Diaries</a></h5>
</div>
<h6>Movie description</h6>
</td>
</tr>
</tbody>
</table>
`

const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})

expect(result).toMatchObject([
{
title: 'The Princess Diaries',
description: 'Movie description'
}
])
})

it('can handle empty guide', () => {
const result = parser({
date,
Expand Down
Loading