Update tests

This commit is contained in:
freearhey 2025-03-07 04:27:16 +03:00
parent c11105e8f7
commit 4bfb062731
7 changed files with 178 additions and 8 deletions

View file

@ -1 +1 @@
[] [{"id":"auto","name":"Auto"},{"id":"animation","name":"Animation"},{"id":"business","name":"Business"},{"id":"classic","name":"Classic"},{"id":"comedy","name":"Comedy"},{"id":"cooking","name":"Cooking"},{"id":"culture","name":"Culture"},{"id":"documentary","name":"Documentary"},{"id":"education","name":"Education"},{"id":"entertainment","name":"Entertainment"},{"id":"family","name":"Family"},{"id":"general","name":"General"},{"id":"kids","name":"Kids"},{"id":"legislative","name":"Legislative"},{"id":"lifestyle","name":"Lifestyle"},{"id":"movies","name":"Movies"},{"id":"music","name":"Music"},{"id":"news","name":"News"},{"id":"outdoor","name":"Outdoor"},{"id":"relax","name":"Relax"},{"id":"religious","name":"Religious"},{"id":"series","name":"Series"},{"id":"science","name":"Science"},{"id":"shop","name":"Shop"},{"id":"sports","name":"Sports"},{"id":"travel","name":"Travel"},{"id":"weather","name":"Weather"},{"id":"xxx","name":"XXX"}]

View file

@ -375,5 +375,32 @@
"replaced_by": null, "replaced_by": null,
"website": "https://calgary.ctvnews.ca/", "website": "https://calgary.ctvnews.ca/",
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/CTV_logo_2018.svg/512px-CTV_logo_2018.svg.png" "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/CTV_logo_2018.svg/512px-CTV_logo_2018.svg.png"
},
{
"id": "ORF2Europe.at",
"name": "ORF 2 Europe",
"alt_names": [],
"network": "ORF",
"owners": [
"ORF"
],
"country": "AT",
"subdivision": "AT-8",
"city": "Vienna",
"broadcast_area": [
"r/EUR"
],
"languages": [
"deu"
],
"categories": [
"culture"
],
"is_nsfw": false,
"launched": "2004-07-05",
"closed": null,
"replaced_by": null,
"website": "https://tv.orf.at/",
"logo": "https://i.imgur.com/Hmcl4qR.png"
} }
] ]

View file

@ -1 +1,18 @@
[{"name":"Dominican Republic","code":"DO","languages":["spa"],"flag":"🇩🇴"}] [
{
"name": "Dominican Republic",
"code": "DO",
"languages": [
"spa"
],
"flag": "🇩🇴"
},
{
"name": "France",
"code": "FR",
"languages": [
"fra"
],
"flag": "🇫🇷"
}
]

View file

@ -1 +1,14 @@
[] [
{
"code": "eng",
"name": "English"
},
{
"code": "fra",
"name": "French"
},
{
"code": "spa",
"name": "Spanish"
}
]

View file

@ -1 +1,58 @@
[] [
{
"code": "EUR",
"name": "Europe",
"countries": [
"AD",
"AL",
"AM",
"AT",
"AZ",
"BA",
"BE",
"BG",
"BY",
"CH",
"CY",
"CZ",
"DE",
"DK",
"EE",
"ES",
"FI",
"FR",
"GE",
"GR",
"HR",
"HU",
"IE",
"IS",
"IT",
"KZ",
"LI",
"LT",
"LU",
"LV",
"MC",
"MD",
"ME",
"MK",
"MT",
"NL",
"NO",
"PL",
"PT",
"RO",
"RS",
"RU",
"SE",
"SI",
"SK",
"SM",
"TR",
"UA",
"UK",
"VA"
]
}
]

View file

@ -1 +1,7 @@
[] [
{
"country": "AR",
"name": "Corrientes",
"code": "AR-W"
}
]

View file

@ -14,7 +14,7 @@ beforeEach(async () => {
describe('search', () => { describe('search', () => {
it('return all channels by default', () => { it('return all channels by default', () => {
const results = get(filteredChannels) const results = get(filteredChannels)
expect(results.length).toBe(14) expect(results.length).toBe(15)
}) })
it('returns empty list if there is no such channel', () => { it('returns empty list if there is no such channel', () => {
@ -110,7 +110,7 @@ describe('search', () => {
}) })
}) })
it('can find channels by country', () => { it('can find channels by country code', () => {
search('country:DO') search('country:DO')
const results = get(filteredChannels) const results = get(filteredChannels)
@ -174,7 +174,7 @@ describe('search', () => {
search('website:.') search('website:.')
const results = get(filteredChannels) const results = get(filteredChannels)
expect(results.length).toBe(13) expect(results.length).toBe(14)
expect(results[0]).toMatchObject({ expect(results[0]).toMatchObject({
id: '002RadioTV.do' id: '002RadioTV.do'
}) })
@ -253,6 +253,56 @@ describe('search', () => {
id: 'SEN502.us' id: 'SEN502.us'
}) })
}) })
it('can find channel by broadcast area name', () => {
search('broadcast_area:"dominican republic"')
const results = get(filteredChannels)
expect(results.length).toBe(1)
expect(results[0]).toMatchObject({
id: '002RadioTV.do'
})
})
it('can find channel by country name', () => {
search('country:"dominican republic"')
const results = get(filteredChannels)
expect(results.length).toBe(1)
expect(results[0]).toMatchObject({
id: '002RadioTV.do'
})
})
it('can find channel by region code', () => {
search('broadcast_area:r/EUR')
const results = get(filteredChannels)
expect(results.length).toBe(1)
expect(results[0]).toMatchObject({
id: 'ORF2Europe.at'
})
})
it('can find channel by region name', () => {
search('broadcast_area:europe')
const results = get(filteredChannels)
expect(results.length).toBe(1)
expect(results[0]).toMatchObject({
id: 'ORF2Europe.at'
})
})
it('can find channel by country name from broadcast region', () => {
search('broadcast_area:france')
const results = get(filteredChannels)
expect(results.length).toBe(3)
expect(results[2]).toMatchObject({
id: 'ORF2Europe.at'
})
})
}) })
function mockFetch() { function mockFetch() {