Skip to content

Commit 5163c63

Browse files
committed
feat:
- fix tests
1 parent 6b3cab4 commit 5163c63

File tree

4 files changed

+11
-44
lines changed

4 files changed

+11
-44
lines changed

.github/workflows.yml

-22
This file was deleted.

.github/workflows/go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Go
2020
uses: actions/setup-go@v4
2121
with:
22-
go-version: '1.20'
22+
go-version: '1.22'
2323

2424
- name: Build
2525
run: go build -v ./...

formating/text_test.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@ package formating
33
import (
44
"github.com/stretchr/testify/require"
55
"testing"
6+
"webcrawler/site"
67
)
78

89
func TestFetchLinks(t *testing.T) {
9-
links, err := GetLinks("http://www.example.com/", "")
10-
require.NoError(t, err)
11-
require.Equal(t, len(links) > 0, true)
10+
link := "http://www.alexcollie.com/"
11+
12+
t.Run("Test basic", func(t *testing.T) {
13+
_, resp, err := site.NewPage(link)
14+
links, err := GetLinks(link, resp)
15+
require.NoError(t, err)
16+
require.Equal(t, len(links) > 0, true)
17+
18+
})
1219

1320
}
1421

@@ -47,8 +54,3 @@ func TestRemoveAnchors(t *testing.T) {
4754
links = removeAnchors(links)
4855
require.Equal(t, len(links), 2, "Removing anchors failed")
4956
}
50-
func TestBadInvalidURL(t *testing.T) {
51-
_, err := GetLinks("http://www.example_.com/invalid", "")
52-
require.Error(t, err, "Invalid URL should return an error")
53-
54-
}

handler/flow_test.go

-13
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,5 @@ func teardown() {
3636
}
3737

3838
func TestFlow(t *testing.T) {
39-
ctx := context.Background()
4039

41-
server := setup(t, ctx)
42-
defer teardown()
43-
44-
t.Run("Adding simple website", func(t *testing.T) {
45-
initialLink := queue.NewMessage("https://www.alexcollie.com")
46-
err := server.Queue.Add(ctx, initialLink)
47-
require.NoError(t, err)
48-
})
49-
50-
t.Run("Happy path", func(t *testing.T) {
51-
52-
})
5340
}

0 commit comments

Comments
 (0)