package github import ( "os" "path" "testing" "git.server.ky/slackcoder/mirror/internal" "github.com/stretchr/testify/require" ) func TestMirrorDendrite(t *testing.T) { d := t.TempDir() dst := internal.MustURL(d) src := internal.MustURL("https://github.com/matrix-org/dendrite") oldFile := "random_file.txt" f, cErr := os.Create(path.Join(dst.Path, oldFile)) require.NoError(t, cErr) f.Close() c := NewClient() err := c.MirrorAssets(dst, src) require.NoError(t, err, "dendrite assets") require.FileExists(t, path.Join(dst.Path, "v0.13.7", "dendrite-0.13.7.tar.gz")) require.FileExists(t, path.Join(dst.Path, "v0.13.7", "dendrite-0.13.7.zip")) err = c.MirrorAssets(dst, src) require.NoError(t, err, "dendrite assets") require.NoFileExists(t, path.Join(dst.Path, oldFile), "only files from mirror should exist") }