diff --git a/tests/__data__/input/categories.json b/tests/__data__/input/categories.json index 0637a088a..c7feeffd9 100644 --- a/tests/__data__/input/categories.json +++ b/tests/__data__/input/categories.json @@ -1 +1 @@ -[] \ No newline at end of file +[{"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"}] \ No newline at end of file diff --git a/tests/__data__/input/channels.json b/tests/__data__/input/channels.json index 300ce1730..c1ba43619 100644 --- a/tests/__data__/input/channels.json +++ b/tests/__data__/input/channels.json @@ -375,5 +375,32 @@ "replaced_by": null, "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" + }, + { + "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" } ] \ No newline at end of file diff --git a/tests/__data__/input/countries.json b/tests/__data__/input/countries.json index 2e4bd87ee..e37785231 100644 --- a/tests/__data__/input/countries.json +++ b/tests/__data__/input/countries.json @@ -1 +1,18 @@ -[{"name":"Dominican Republic","code":"DO","languages":["spa"],"flag":"🇩🇴"}] \ No newline at end of file +[ + { + "name": "Dominican Republic", + "code": "DO", + "languages": [ + "spa" + ], + "flag": "🇩🇴" + }, + { + "name": "France", + "code": "FR", + "languages": [ + "fra" + ], + "flag": "🇫🇷" + } +] \ No newline at end of file diff --git a/tests/__data__/input/languages.json b/tests/__data__/input/languages.json index 0637a088a..79d236cb7 100644 --- a/tests/__data__/input/languages.json +++ b/tests/__data__/input/languages.json @@ -1 +1,14 @@ -[] \ No newline at end of file +[ + { + "code": "eng", + "name": "English" + }, + { + "code": "fra", + "name": "French" + }, + { + "code": "spa", + "name": "Spanish" + } +] \ No newline at end of file diff --git a/tests/__data__/input/regions.json b/tests/__data__/input/regions.json index 0637a088a..b2293b719 100644 --- a/tests/__data__/input/regions.json +++ b/tests/__data__/input/regions.json @@ -1 +1,58 @@ -[] \ No newline at end of file +[ + { + "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" + ] + } +] \ No newline at end of file diff --git a/tests/__data__/input/subdivisions.json b/tests/__data__/input/subdivisions.json index 0637a088a..3444be136 100644 --- a/tests/__data__/input/subdivisions.json +++ b/tests/__data__/input/subdivisions.json @@ -1 +1,7 @@ -[] \ No newline at end of file +[ + { + "country": "AR", + "name": "Corrientes", + "code": "AR-W" + } +] \ No newline at end of file diff --git a/tests/store.test.js b/tests/store.test.js index a7f7a8cdf..812498a4a 100644 --- a/tests/store.test.js +++ b/tests/store.test.js @@ -14,7 +14,7 @@ beforeEach(async () => { describe('search', () => { it('return all channels by default', () => { const results = get(filteredChannels) - expect(results.length).toBe(14) + expect(results.length).toBe(15) }) 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') const results = get(filteredChannels) @@ -174,7 +174,7 @@ describe('search', () => { search('website:.') const results = get(filteredChannels) - expect(results.length).toBe(13) + expect(results.length).toBe(14) expect(results[0]).toMatchObject({ id: '002RadioTV.do' }) @@ -253,6 +253,56 @@ describe('search', () => { 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() {