finder_test.go 745 B

123456789101112131415161718192021
  1. // Copyright 2020 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package subscription
  5. import "testing"
  6. func TestFindYoutubeChannelFeed(t *testing.T) {
  7. scenarios := map[string]string{
  8. "https://www.youtube.com/channel/UC-Qj80avWItNRjkZ41rzHyw": "https://www.youtube.com/feeds/videos.xml?channel_id=UC-Qj80avWItNRjkZ41rzHyw",
  9. "http://example.org/feed": "http://example.org/feed",
  10. }
  11. for websiteURL, expectedFeedURL := range scenarios {
  12. result := findYoutubeChannelFeed(websiteURL)
  13. if result != expectedFeedURL {
  14. t.Errorf(`Unexpected Feed, got %s, instead of %s`, result, expectedFeedURL)
  15. }
  16. }
  17. }