From d5e243aca4f5ec26f5d01bde1026f56e5d591ecf Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sat, 7 Oct 2023 05:13:45 +0300 Subject: [PATCH] Add tests data --- tests/__data__/expected/api/blocklist.json | 1 + tests/__data__/expected/api/channels.json | 1 + tests/__data__/expected/data/blocklist.csv | 2 + tests/__data__/expected/data/channels.csv | 6 + tests/__data__/input/data/blocklist.csv | 2 + tests/__data__/input/data/channels.csv | 4 + .../input/issues/blocklist_add_approved.js | 81 ++++++ .../input/issues/blocklist_remove_approved.js | 81 ++++++ .../input/issues/channels_add_approved.js | 239 ++++++++++++++++++ .../input/issues/channels_edit_approved.js | 160 ++++++++++++ .../input/issues/channels_remove_approved.js | 81 ++++++ .../input/validate/duplicate/categories.csv | 3 + .../input/validate/empty_line/channels.csv | 1 + .../invalid_line_ending/categories.csv | 2 + .../validate/invalid_value/blocklist.csv | 2 + .../input/validate/invalid_value/channels.csv | 2 + .../validate/invalid_value/countries.csv | 3 + .../validate/invalid_value/languages.csv | 3 + .../validate/invalid_value/subdivisions.csv | 2 + .../validate/wrong_num_cols/categories.csv | 2 + tests/__data__/output/api/blocklist.json | 1 + tests/__data__/output/api/channels.json | 1 + 22 files changed, 680 insertions(+) create mode 100644 tests/__data__/expected/api/blocklist.json create mode 100644 tests/__data__/expected/api/channels.json create mode 100644 tests/__data__/expected/data/blocklist.csv create mode 100644 tests/__data__/expected/data/channels.csv create mode 100644 tests/__data__/input/data/blocklist.csv create mode 100644 tests/__data__/input/data/channels.csv create mode 100644 tests/__data__/input/issues/blocklist_add_approved.js create mode 100644 tests/__data__/input/issues/blocklist_remove_approved.js create mode 100644 tests/__data__/input/issues/channels_add_approved.js create mode 100644 tests/__data__/input/issues/channels_edit_approved.js create mode 100644 tests/__data__/input/issues/channels_remove_approved.js create mode 100644 tests/__data__/input/validate/duplicate/categories.csv create mode 100644 tests/__data__/input/validate/empty_line/channels.csv create mode 100644 tests/__data__/input/validate/invalid_line_ending/categories.csv create mode 100644 tests/__data__/input/validate/invalid_value/blocklist.csv create mode 100644 tests/__data__/input/validate/invalid_value/channels.csv create mode 100644 tests/__data__/input/validate/invalid_value/countries.csv create mode 100644 tests/__data__/input/validate/invalid_value/languages.csv create mode 100644 tests/__data__/input/validate/invalid_value/subdivisions.csv create mode 100644 tests/__data__/input/validate/wrong_num_cols/categories.csv create mode 100644 tests/__data__/output/api/blocklist.json create mode 100644 tests/__data__/output/api/channels.json diff --git a/tests/__data__/expected/api/blocklist.json b/tests/__data__/expected/api/blocklist.json new file mode 100644 index 00000000..8a66ad1a --- /dev/null +++ b/tests/__data__/expected/api/blocklist.json @@ -0,0 +1 @@ +[{"channel":"AnimalPlanetAfrica.za","ref":"https://github.com/iptv-org/iptv/issues/1831"}] \ No newline at end of file diff --git a/tests/__data__/expected/api/channels.json b/tests/__data__/expected/api/channels.json new file mode 100644 index 00000000..c7651abf --- /dev/null +++ b/tests/__data__/expected/api/channels.json @@ -0,0 +1 @@ +[{"id":"002RadioTV.do","name":"002 Radio TV","alt_names":[],"network":null,"owners":[],"country":"DO","subdivision":null,"city":null,"broadcast_area":["c/DO"],"languages":["spa"],"categories":["general"],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"https://www.002radio.com/","logo":"https://i.imgur.com/7oNe8xj.png"},{"id":"BeijingSatelliteTV.cn","name":"Beijing Satellite TV","alt_names":["北京卫视"],"network":null,"owners":[],"country":"CN","subdivision":null,"city":"Beijing","broadcast_area":["c/CN"],"languages":["zho"],"categories":["general"],"is_nsfw":false,"launched":"1979-05-16","closed":null,"replaced_by":null,"website":"https://www.brtn.cn/btv/","logo":"https://i.imgur.com/vsktAez.png"},{"id":"M5.hu","name":"M5","alt_names":[],"network":null,"owners":[],"country":"HU","subdivision":null,"city":null,"broadcast_area":["c/HU"],"languages":["hun"],"categories":[],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"https://www.mediaklikk.hu/m5/","logo":"https://i.imgur.com/y21wFd0.png"}] \ No newline at end of file diff --git a/tests/__data__/expected/data/blocklist.csv b/tests/__data__/expected/data/blocklist.csv new file mode 100644 index 00000000..ff5b8c90 --- /dev/null +++ b/tests/__data__/expected/data/blocklist.csv @@ -0,0 +1,2 @@ +channel,ref +HGTVHungary.hu,https://github.com/iptv-org/iptv/issues/1831 \ No newline at end of file diff --git a/tests/__data__/expected/data/channels.csv b/tests/__data__/expected/data/channels.csv new file mode 100644 index 00000000..bc08e199 --- /dev/null +++ b/tests/__data__/expected/data/channels.csv @@ -0,0 +1,6 @@ +id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo +beINMoviesTurk.tr,beIN Movies Turk,beIN Movies Türk,,,TR,,Beijing,c/TR,tur,movies,FALSE,1979-05-16,,,http://www.digiturk.com.tr/,https://i.imgur.com/nw8Sa2z.png +M5.hu,M5,,,Duna Médiaszolgáltató Nonprofit Zrt.,HU,,,c/HU,hun,,FALSE,,,,https://www.mediaklikk.hu/m5/,https://i.imgur.com/y21wFd0.png +WenzhouEconomicandEducation.cn,Wenzhou Economic and Education,,,,CN,,Wenzhou,c/CN,zho,science,FALSE,,,,,https://www.tvchinese.net/uploads/tv/wzjjkj.jpg +YiwuBusinessChannel.cn,Yiwu Business Channel,,,,CN,,,c/CN,zho,business,FALSE,,,,,https://www.tvchinese.net/uploads/tv/yiwutv.jpg +YiwuNewsIntegratedChannel.cn,Yiwu News Integrated Channel,,,,CN,,,c/CN,zho,news,FALSE,,,,,https://www.tvchinese.net/uploads/tv/yiwutv.jpg \ No newline at end of file diff --git a/tests/__data__/input/data/blocklist.csv b/tests/__data__/input/data/blocklist.csv new file mode 100644 index 00000000..6695ea21 --- /dev/null +++ b/tests/__data__/input/data/blocklist.csv @@ -0,0 +1,2 @@ +channel,ref +AnimalPlanetAfrica.za,https://github.com/iptv-org/iptv/issues/1831 \ No newline at end of file diff --git a/tests/__data__/input/data/channels.csv b/tests/__data__/input/data/channels.csv new file mode 100644 index 00000000..dcbdb911 --- /dev/null +++ b/tests/__data__/input/data/channels.csv @@ -0,0 +1,4 @@ +id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo +002RadioTV.do,002 Radio TV,,,,DO,,,c/DO,spa,general,FALSE,,,,https://www.002radio.com/,https://i.imgur.com/7oNe8xj.png +BeijingSatelliteTV.cn,Beijing Satellite TV,北京卫视,,,CN,,Beijing,c/CN,zho,general,FALSE,1979-05-16,,,https://www.brtn.cn/btv/,https://i.imgur.com/vsktAez.png +M5.hu,M5,,,,HU,,,c/HU,hun,,FALSE,,,,https://www.mediaklikk.hu/m5/,https://i.imgur.com/y21wFd0.png \ No newline at end of file diff --git a/tests/__data__/input/issues/blocklist_add_approved.js b/tests/__data__/input/issues/blocklist_add_approved.js new file mode 100644 index 00000000..efddef9e --- /dev/null +++ b/tests/__data__/input/issues/blocklist_add_approved.js @@ -0,0 +1,81 @@ +module.exports = [ + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5897', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5897/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5897/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5897/events', + html_url: 'https://github.com/iptv-org/database/issues/5897', + id: 1929261634, + node_id: 'I_kwDOG1Kwp85y_jJC', + number: 5897, + title: 'Block: HGTV Hungary', + user: { + login: 'freearhey', + id: 7253922, + node_id: 'MDQ6VXNlcjcyNTM5MjI=', + avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/freearhey', + html_url: 'https://github.com/freearhey', + followers_url: 'https://api.github.com/users/freearhey/followers', + following_url: 'https://api.github.com/users/freearhey/following{/other_user}', + gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}', + starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions', + organizations_url: 'https://api.github.com/users/freearhey/orgs', + repos_url: 'https://api.github.com/users/freearhey/repos', + events_url: 'https://api.github.com/users/freearhey/events{/privacy}', + received_events_url: 'https://api.github.com/users/freearhey/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + }, + { + id: 6049155772, + node_id: 'LA_kwDOG1Kwp88AAAABaI7KvA', + url: 'https://api.github.com/repos/iptv-org/database/labels/blocklist:add', + name: 'blocklist:add', + color: 'e99695', + default: false, + description: 'Request to add a channel to the blocklist' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T00:35:32Z', + updated_at: '2023-10-06T00:35:32Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel ID\n\nHGTVHungary.hu\n\n### Reference\n\nhttps://github.com/iptv-org/iptv/issues/1831\n\n### Notes (optional)\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5897/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5897/timeline', + performed_via_github_app: null, + state_reason: null + } +] diff --git a/tests/__data__/input/issues/blocklist_remove_approved.js b/tests/__data__/input/issues/blocklist_remove_approved.js new file mode 100644 index 00000000..3644c21e --- /dev/null +++ b/tests/__data__/input/issues/blocklist_remove_approved.js @@ -0,0 +1,81 @@ +module.exports = [ + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5891', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5891/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5891/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5891/events', + html_url: 'https://github.com/iptv-org/database/issues/5891', + id: 1929261634, + node_id: 'I_kwDOG1Kwp85y_jJC', + number: 5891, + title: 'Unblock: Animal Planet Africa', + user: { + login: 'freearhey', + id: 7253922, + node_id: 'MDQ6VXNlcjcyNTM5MjI=', + avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/freearhey', + html_url: 'https://github.com/freearhey', + followers_url: 'https://api.github.com/users/freearhey/followers', + following_url: 'https://api.github.com/users/freearhey/following{/other_user}', + gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}', + starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions', + organizations_url: 'https://api.github.com/users/freearhey/orgs', + repos_url: 'https://api.github.com/users/freearhey/repos', + events_url: 'https://api.github.com/users/freearhey/events{/privacy}', + received_events_url: 'https://api.github.com/users/freearhey/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + }, + { + id: 6049155772, + node_id: 'LA_kwDOG1Kwp88AAAABaI7KvA', + url: 'https://api.github.com/repos/iptv-org/database/labels/blocklist:add', + name: 'blocklist:remove', + color: 'e99695', + default: false, + description: 'Request to remove a channel from the blocklist' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T00:35:32Z', + updated_at: '2023-10-06T00:35:32Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel ID\n\nAnimalPlanetAfrica.za\n\n### Reason\n\nOther\n\n### Notes (optional)\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5891/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5891/timeline', + performed_via_github_app: null, + state_reason: null + } +] diff --git a/tests/__data__/input/issues/channels_add_approved.js b/tests/__data__/input/issues/channels_add_approved.js new file mode 100644 index 00000000..12472861 --- /dev/null +++ b/tests/__data__/input/issues/channels_add_approved.js @@ -0,0 +1,239 @@ +module.exports = [ + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5900', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5900/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5900/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5900/events', + html_url: 'https://github.com/iptv-org/database/issues/5900', + id: 1929321995, + node_id: 'I_kwDOG1Kwp85y_x4L', + number: 5900, + title: 'Add: Yiwu News Integrated Channel', + user: { + login: 'AntiPontifex', + id: 81566772, + node_id: 'MDQ6VXNlcjgxNTY2Nzcy', + avatar_url: 'https://avatars.githubusercontent.com/u/81566772?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/AntiPontifex', + html_url: 'https://github.com/AntiPontifex', + followers_url: 'https://api.github.com/users/AntiPontifex/followers', + following_url: 'https://api.github.com/users/AntiPontifex/following{/other_user}', + gists_url: 'https://api.github.com/users/AntiPontifex/gists{/gist_id}', + starred_url: 'https://api.github.com/users/AntiPontifex/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/AntiPontifex/subscriptions', + organizations_url: 'https://api.github.com/users/AntiPontifex/orgs', + repos_url: 'https://api.github.com/users/AntiPontifex/repos', + events_url: 'https://api.github.com/users/AntiPontifex/events{/privacy}', + received_events_url: 'https://api.github.com/users/AntiPontifex/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5303575699, + node_id: 'LA_kwDOG1Kwp88AAAABPB4kkw', + url: 'https://api.github.com/repos/iptv-org/database/labels/channels:add', + name: 'channels:add', + color: '017ff8', + default: false, + description: 'Request to add a channel into the database' + }, + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T02:10:41Z', + updated_at: '2023-10-06T02:52:02Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel Name\n\nYiwu News Integrated Channel\n\n### Alternative Names (optional)\n\n_No response_\n\n### Network (optional)\n\n_No response_\n\n### Owners (optional)\n\n_No response_\n\n### Country\n\nCN\n\n### Subdivision (optional)\n\n_No response_\n\n### City (optional)\n\n_No response_\n\n### Broadcast Area\n\nc/CN\n\n### Languages\n\nzho\n\n### Categories (optional)\n\nnews\n\n### NSFW\n\nFALSE\n\n### Launched (optional)\n\n_No response_\n\n### Closed (optional)\n\n_No response_\n\n### Replaced By (optional)\n\n_No response_\n\n### Website (optional)\n\n_No response_\n\n### Logo\n\nhttps://www.tvchinese.net/uploads/tv/yiwutv.jpg\n\n### Notes\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5900/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5900/timeline', + performed_via_github_app: null, + state_reason: null + }, + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5899', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5899/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5899/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5899/events', + html_url: 'https://github.com/iptv-org/database/issues/5899', + id: 1929318573, + node_id: 'I_kwDOG1Kwp85y_xCt', + number: 5899, + title: 'Add: Yiwu Business Channel', + user: { + login: 'AntiPontifex', + id: 81566772, + node_id: 'MDQ6VXNlcjgxNTY2Nzcy', + avatar_url: 'https://avatars.githubusercontent.com/u/81566772?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/AntiPontifex', + html_url: 'https://github.com/AntiPontifex', + followers_url: 'https://api.github.com/users/AntiPontifex/followers', + following_url: 'https://api.github.com/users/AntiPontifex/following{/other_user}', + gists_url: 'https://api.github.com/users/AntiPontifex/gists{/gist_id}', + starred_url: 'https://api.github.com/users/AntiPontifex/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/AntiPontifex/subscriptions', + organizations_url: 'https://api.github.com/users/AntiPontifex/orgs', + repos_url: 'https://api.github.com/users/AntiPontifex/repos', + events_url: 'https://api.github.com/users/AntiPontifex/events{/privacy}', + received_events_url: 'https://api.github.com/users/AntiPontifex/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5303575699, + node_id: 'LA_kwDOG1Kwp88AAAABPB4kkw', + url: 'https://api.github.com/repos/iptv-org/database/labels/channels:add', + name: 'channels:add', + color: '017ff8', + default: false, + description: 'Request to add a channel into the database' + }, + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T02:05:11Z', + updated_at: '2023-10-06T02:51:46Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel Name\n\nYiwu Business Channel\n\n### Alternative Names (optional)\n\n_No response_\n\n### Network (optional)\n\n_No response_\n\n### Owners (optional)\n\n_No response_\n\n### Country\n\nCN\n\n### Subdivision (optional)\n\n_No response_\n\n### City (optional)\n\n_No response_\n\n### Broadcast Area\n\nc/CN\n\n### Languages\n\nzho\n\n### Categories (optional)\n\nbusiness\n\n### NSFW\n\nFALSE\n\n### Launched (optional)\n\n_No response_\n\n### Closed (optional)\n\n_No response_\n\n### Replaced By (optional)\n\n_No response_\n\n### Website (optional)\n\n_No response_\n\n### Logo\n\nhttps://www.tvchinese.net/uploads/tv/yiwutv.jpg\n\n### Notes\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5899/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5899/timeline', + performed_via_github_app: null, + state_reason: null + }, + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5898', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5898/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5898/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5898/events', + html_url: 'https://github.com/iptv-org/database/issues/5898', + id: 1929313117, + node_id: 'I_kwDOG1Kwp85y_vtd', + number: 5898, + title: 'Add: Wenzhou Economic and Education', + user: { + login: 'AntiPontifex', + id: 81566772, + node_id: 'MDQ6VXNlcjgxNTY2Nzcy', + avatar_url: 'https://avatars.githubusercontent.com/u/81566772?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/AntiPontifex', + html_url: 'https://github.com/AntiPontifex', + followers_url: 'https://api.github.com/users/AntiPontifex/followers', + following_url: 'https://api.github.com/users/AntiPontifex/following{/other_user}', + gists_url: 'https://api.github.com/users/AntiPontifex/gists{/gist_id}', + starred_url: 'https://api.github.com/users/AntiPontifex/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/AntiPontifex/subscriptions', + organizations_url: 'https://api.github.com/users/AntiPontifex/orgs', + repos_url: 'https://api.github.com/users/AntiPontifex/repos', + events_url: 'https://api.github.com/users/AntiPontifex/events{/privacy}', + received_events_url: 'https://api.github.com/users/AntiPontifex/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5303575699, + node_id: 'LA_kwDOG1Kwp88AAAABPB4kkw', + url: 'https://api.github.com/repos/iptv-org/database/labels/channels:add', + name: 'channels:add', + color: '017ff8', + default: false, + description: 'Request to add a channel into the database' + }, + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T01:56:32Z', + updated_at: '2023-10-06T02:51:22Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel Name\n\nWenzhou Economic and Education\n\n### Alternative Names (optional)\n\n_No response_\n\n### Network (optional)\n\n_No response_\n\n### Owners (optional)\n\n_No response_\n\n### Country\n\nCN\n\n### Subdivision (optional)\n\n_No response_\n\n### City (optional)\n\nWenzhou\n\n### Broadcast Area\n\nc/CN\n\n### Languages\n\nzho\n\n### Categories (optional)\n\nscience\n\n### NSFW\n\nFALSE\n\n### Launched (optional)\n\n_No response_\n\n### Closed (optional)\n\n_No response_\n\n### Replaced By (optional)\n\n_No response_\n\n### Website (optional)\n\n_No response_\n\n### Logo\n\nhttps://www.tvchinese.net/uploads/tv/wzjjkj.jpg\n\n### Notes\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5898/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5898/timeline', + performed_via_github_app: null, + state_reason: null + } +] diff --git a/tests/__data__/input/issues/channels_edit_approved.js b/tests/__data__/input/issues/channels_edit_approved.js new file mode 100644 index 00000000..6088c065 --- /dev/null +++ b/tests/__data__/input/issues/channels_edit_approved.js @@ -0,0 +1,160 @@ +module.exports = [ + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5901', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5901/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5901/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5901/events', + html_url: 'https://github.com/iptv-org/database/issues/5901', + id: 1929459171, + node_id: 'I_kwDOG1Kwp85zATXj', + number: 5901, + title: 'Edit: M5', + user: { + login: 'freearhey', + id: 7253922, + node_id: 'MDQ6VXNlcjcyNTM5MjI=', + avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/freearhey', + html_url: 'https://github.com/freearhey', + followers_url: 'https://api.github.com/users/freearhey/followers', + following_url: 'https://api.github.com/users/freearhey/following{/other_user}', + gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}', + starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions', + organizations_url: 'https://api.github.com/users/freearhey/orgs', + repos_url: 'https://api.github.com/users/freearhey/repos', + events_url: 'https://api.github.com/users/freearhey/events{/privacy}', + received_events_url: 'https://api.github.com/users/freearhey/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5303574335, + node_id: 'LA_kwDOG1Kwp88AAAABPB4fPw', + url: 'https://api.github.com/repos/iptv-org/database/labels/channels:edit', + name: 'channels:edit', + color: 'E12977', + default: false, + description: 'Request to edit channel description' + }, + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T05:25:44Z', + updated_at: '2023-10-06T05:25:44Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel ID (required)\n\nM5.hu\n\n### Channel Name\n\n_No response_\n\n### Alternative Names\n\n_No response_\n\n### Network\n\n_No response_\n\n### Owners\n\nDuna Médiaszolgáltató Nonprofit Zrt.\n\n### Country\n\n_No response_\n\n### Subdivision\n\n_No response_\n\n### City\n\n_No response_\n\n### Broadcast Area\n\n_No response_\n\n### Languages\n\n_No response_\n\n### Categories\n\n_No response_\n\n### NSFW\n\nFALSE\n\n### Launched\n\n_No response_\n\n### Closed\n\n_No response_\n\n### Replaced By\n\n_No response_\n\n### Website\n\n_No response_\n\n### Logo\n\n_No response_\n\n### Notes\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5901/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5901/timeline', + performed_via_github_app: null, + state_reason: null + }, + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5701', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5701/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5701/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5701/events', + html_url: 'https://github.com/iptv-org/database/issues/5701', + id: 1929459171, + node_id: 'I_kwDOG1Kwp85zATXj', + number: 5701, + title: 'Edit: M5', + user: { + login: 'freearhey', + id: 7253922, + node_id: 'MDQ6VXNlcjcyNTM5MjI=', + avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/freearhey', + html_url: 'https://github.com/freearhey', + followers_url: 'https://api.github.com/users/freearhey/followers', + following_url: 'https://api.github.com/users/freearhey/following{/other_user}', + gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}', + starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions', + organizations_url: 'https://api.github.com/users/freearhey/orgs', + repos_url: 'https://api.github.com/users/freearhey/repos', + events_url: 'https://api.github.com/users/freearhey/events{/privacy}', + received_events_url: 'https://api.github.com/users/freearhey/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5303574335, + node_id: 'LA_kwDOG1Kwp88AAAABPB4fPw', + url: 'https://api.github.com/repos/iptv-org/database/labels/channels:edit', + name: 'channels:edit', + color: 'E12977', + default: false, + description: 'Request to edit channel description' + }, + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T05:25:44Z', + updated_at: '2023-10-06T05:25:44Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel ID (required)\n\nBeijingSatelliteTV.cn\n\n### Channel Name\n\nbeIN Movies Turk\n\n### Alternative Names\n\nbeIN Movies Türk\n\n### Network\n\n_No response_\n\n### Owners\n\n_No response_\n\n### Country\n\nTR\n\n### Subdivision\n\n_No response_\n\n### City\n\n_No response_\n\n### Broadcast Area\n\nc/TR\n\n### Languages\n\ntur\n\n### Categories\n\nmovies\n\n### NSFW\n\nFALSE\n\n### Launched\n\n1979-05-16\n\n### Closed\n\n_No response_\n\n### Replaced By\n\n_No response_\n\n### Website\n\nhttp://www.digiturk.com.tr/\n\n### Logo\n\nhttps://i.imgur.com/nw8Sa2z.png\n\n### Notes\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5701/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5701/timeline', + performed_via_github_app: null, + state_reason: null + } +] diff --git a/tests/__data__/input/issues/channels_remove_approved.js b/tests/__data__/input/issues/channels_remove_approved.js new file mode 100644 index 00000000..96ff8cad --- /dev/null +++ b/tests/__data__/input/issues/channels_remove_approved.js @@ -0,0 +1,81 @@ +module.exports = [ + { + url: 'https://api.github.com/repos/iptv-org/database/issues/5871', + repository_url: 'https://api.github.com/repos/iptv-org/database', + labels_url: 'https://api.github.com/repos/iptv-org/database/issues/5871/labels{/name}', + comments_url: 'https://api.github.com/repos/iptv-org/database/issues/5871/comments', + events_url: 'https://api.github.com/repos/iptv-org/database/issues/5871/events', + html_url: 'https://github.com/iptv-org/database/issues/5871', + id: 1929261634, + node_id: 'I_kwDOG1Kwp85y_jJC', + number: 5871, + title: 'Remove: 002 Radio TV', + user: { + login: 'freearhey', + id: 7253922, + node_id: 'MDQ6VXNlcjcyNTM5MjI=', + avatar_url: 'https://avatars.githubusercontent.com/u/7253922?v=4', + gravatar_id: '', + url: 'https://api.github.com/users/freearhey', + html_url: 'https://github.com/freearhey', + followers_url: 'https://api.github.com/users/freearhey/followers', + following_url: 'https://api.github.com/users/freearhey/following{/other_user}', + gists_url: 'https://api.github.com/users/freearhey/gists{/gist_id}', + starred_url: 'https://api.github.com/users/freearhey/starred{/owner}{/repo}', + subscriptions_url: 'https://api.github.com/users/freearhey/subscriptions', + organizations_url: 'https://api.github.com/users/freearhey/orgs', + repos_url: 'https://api.github.com/users/freearhey/repos', + events_url: 'https://api.github.com/users/freearhey/events{/privacy}', + received_events_url: 'https://api.github.com/users/freearhey/received_events', + type: 'User', + site_admin: false + }, + labels: [ + { + id: 5366738347, + node_id: 'LA_kwDOG1Kwp88AAAABP-Htqw', + url: 'https://api.github.com/repos/iptv-org/database/labels/approved', + name: 'approved', + color: '85DDDE', + default: false, + description: '' + }, + { + id: 6049155772, + node_id: 'LA_kwDOG1Kwp88AAAABaI7KvA', + url: 'https://api.github.com/repos/iptv-org/database/labels/blocklist:add', + name: 'channels:remove', + color: 'e99695', + default: false, + description: 'Request to remove a channel' + } + ], + state: 'open', + locked: false, + assignee: null, + assignees: [], + milestone: null, + comments: 0, + created_at: '2023-10-06T00:35:32Z', + updated_at: '2023-10-06T00:35:32Z', + closed_at: null, + author_association: 'CONTRIBUTOR', + active_lock_reason: null, + body: '### Channel ID\n\n002RadioTV.do\n\n### Reason\n\nOther\n\n### Notes (optional)\n\n_No response_', + reactions: { + url: 'https://api.github.com/repos/iptv-org/database/issues/5871/reactions', + total_count: 0, + '+1': 0, + '-1': 0, + laugh: 0, + hooray: 0, + confused: 0, + heart: 0, + rocket: 0, + eyes: 0 + }, + timeline_url: 'https://api.github.com/repos/iptv-org/database/issues/5871/timeline', + performed_via_github_app: null, + state_reason: null + } +] diff --git a/tests/__data__/input/validate/duplicate/categories.csv b/tests/__data__/input/validate/duplicate/categories.csv new file mode 100644 index 00000000..c09a76df --- /dev/null +++ b/tests/__data__/input/validate/duplicate/categories.csv @@ -0,0 +1,3 @@ +id,name +aaa,AAA +aaa,BBB \ No newline at end of file diff --git a/tests/__data__/input/validate/empty_line/channels.csv b/tests/__data__/input/validate/empty_line/channels.csv new file mode 100644 index 00000000..52bd1c4c --- /dev/null +++ b/tests/__data__/input/validate/empty_line/channels.csv @@ -0,0 +1 @@ +id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo diff --git a/tests/__data__/input/validate/invalid_line_ending/categories.csv b/tests/__data__/input/validate/invalid_line_ending/categories.csv new file mode 100644 index 00000000..526ec916 --- /dev/null +++ b/tests/__data__/input/validate/invalid_line_ending/categories.csv @@ -0,0 +1,2 @@ +id,name +aaa,AAA \ No newline at end of file diff --git a/tests/__data__/input/validate/invalid_value/blocklist.csv b/tests/__data__/input/validate/invalid_value/blocklist.csv new file mode 100644 index 00000000..bb01b0f8 --- /dev/null +++ b/tests/__data__/input/validate/invalid_value/blocklist.csv @@ -0,0 +1,2 @@ +channel,ref +aaa.us,https://github.com/iptv-org/iptv/issues/1831 \ No newline at end of file diff --git a/tests/__data__/input/validate/invalid_value/channels.csv b/tests/__data__/input/validate/invalid_value/channels.csv new file mode 100644 index 00000000..133d1c8c --- /dev/null +++ b/tests/__data__/input/validate/invalid_value/channels.csv @@ -0,0 +1,2 @@ +id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo +002RadioTV.do,002 Radio TV,,,,DO,,,c/DO,spa,,FALSE,,,,https://www.002radio.com/,https://i.imgur.com/7oNe8xj.png \ No newline at end of file diff --git a/tests/__data__/input/validate/invalid_value/countries.csv b/tests/__data__/input/validate/invalid_value/countries.csv new file mode 100644 index 00000000..8a1c05e5 --- /dev/null +++ b/tests/__data__/input/validate/invalid_value/countries.csv @@ -0,0 +1,3 @@ +name,code,languages,flag +Andorra,AD,cat,🇦🇩 +Dominican Republic,DO,spa,🇩🇴 \ No newline at end of file diff --git a/tests/__data__/input/validate/invalid_value/languages.csv b/tests/__data__/input/validate/invalid_value/languages.csv new file mode 100644 index 00000000..7e3eb4b4 --- /dev/null +++ b/tests/__data__/input/validate/invalid_value/languages.csv @@ -0,0 +1,3 @@ +code,name +cat,Catalan +spa,Spanish \ No newline at end of file diff --git a/tests/__data__/input/validate/invalid_value/subdivisions.csv b/tests/__data__/input/validate/invalid_value/subdivisions.csv new file mode 100644 index 00000000..9498b609 --- /dev/null +++ b/tests/__data__/input/validate/invalid_value/subdivisions.csv @@ -0,0 +1,2 @@ +country,name,code +AD,Andorra la Vella,AD-07 \ No newline at end of file diff --git a/tests/__data__/input/validate/wrong_num_cols/categories.csv b/tests/__data__/input/validate/wrong_num_cols/categories.csv new file mode 100644 index 00000000..36c48f12 --- /dev/null +++ b/tests/__data__/input/validate/wrong_num_cols/categories.csv @@ -0,0 +1,2 @@ +id,name +auto \ No newline at end of file diff --git a/tests/__data__/output/api/blocklist.json b/tests/__data__/output/api/blocklist.json new file mode 100644 index 00000000..8a66ad1a --- /dev/null +++ b/tests/__data__/output/api/blocklist.json @@ -0,0 +1 @@ +[{"channel":"AnimalPlanetAfrica.za","ref":"https://github.com/iptv-org/iptv/issues/1831"}] \ No newline at end of file diff --git a/tests/__data__/output/api/channels.json b/tests/__data__/output/api/channels.json new file mode 100644 index 00000000..c7651abf --- /dev/null +++ b/tests/__data__/output/api/channels.json @@ -0,0 +1 @@ +[{"id":"002RadioTV.do","name":"002 Radio TV","alt_names":[],"network":null,"owners":[],"country":"DO","subdivision":null,"city":null,"broadcast_area":["c/DO"],"languages":["spa"],"categories":["general"],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"https://www.002radio.com/","logo":"https://i.imgur.com/7oNe8xj.png"},{"id":"BeijingSatelliteTV.cn","name":"Beijing Satellite TV","alt_names":["北京卫视"],"network":null,"owners":[],"country":"CN","subdivision":null,"city":"Beijing","broadcast_area":["c/CN"],"languages":["zho"],"categories":["general"],"is_nsfw":false,"launched":"1979-05-16","closed":null,"replaced_by":null,"website":"https://www.brtn.cn/btv/","logo":"https://i.imgur.com/vsktAez.png"},{"id":"M5.hu","name":"M5","alt_names":[],"network":null,"owners":[],"country":"HU","subdivision":null,"city":null,"broadcast_area":["c/HU"],"languages":["hun"],"categories":[],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"https://www.mediaklikk.hu/m5/","logo":"https://i.imgur.com/y21wFd0.png"}] \ No newline at end of file