Skip to content

Commit

Permalink
add test for findFeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
nekr0z committed Apr 1, 2020
1 parent 6280f9a commit 3d8eef4
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions testdata/prod/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
old contents
1 change: 1 addition & 0 deletions testdata/prod/posts/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
old contents
1 change: 1 addition & 0 deletions testdata/prod/tags/a/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
same contents
1 change: 1 addition & 0 deletions testdata/staging/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
same contents
1 change: 1 addition & 0 deletions testdata/staging/posts/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
same contents
1 change: 1 addition & 0 deletions testdata/staging/tags/a/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
same contents
1 change: 1 addition & 0 deletions testdata/staging/tags/b/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
same contents
40 changes: 40 additions & 0 deletions websub_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (C) 2020 Evgeny Kuznetsov ([email protected])
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

package main

import (
"path/filepath"
"testing"
)

func TestFindFeeds(t *testing.T) {
var cfg config
cfg.baseURL = "https://my.site/"
cfg.oldDir = filepath.Join("testdata", "prod")
cfg.newDir = filepath.Join("testdata", "staging")

want := []string{
"https://my.site/index.xml",
"https://my.site/posts/index.xml",
"https://my.site/tags/b/index.xml",
}

got := findFeeds(cfg)

if !stringSlicesEqual(want, got) {
t.Fatalf("want:\n%s\ngot:\n%s\n", want, got)
}
}

0 comments on commit 3d8eef4

Please sign in to comment.