Fix reduce network calls count for the target url

This commit is contained in:
2023-11-16 23:46:01 +03:00
parent e27fdabf78
commit 9912b7e436
7 changed files with 106 additions and 35 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/derfenix/webarchive/config"
"github.com/derfenix/webarchive/entity"
)
func TestProcessors_GetMeta(t *testing.T) {
@@ -20,7 +21,9 @@ func TestProcessors_GetMeta(t *testing.T) {
procs, err := NewProcessors(cfg)
require.NoError(t, err)
meta, err := procs.GetMeta(ctx, "https://habr.com/ru/companies/wirenboard/articles/722718/")
cache := entity.NewCache()
meta, err := procs.GetMeta(ctx, "https://habr.com/ru/companies/wirenboard/articles/722718/", cache)
require.NoError(t, err)
assert.Equal(t, "Сколько стоит умный дом? Рассказываю, как строил свой и что получилось за 1000 руб./м² / Хабр", meta.Title)
}