kinda janky with the implementation right now, later i would like to improve the way files are copied and allow for mods with multiple downloads attached to the mod. probably split off some of the functionality later to add installing mods not on gamebanana easier.
24 lines
547 B
Go
24 lines
547 B
Go
package gamebanana
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
"testing"
|
|
)
|
|
|
|
func TestDownloadGameBananaMod(t *testing.T) {
|
|
tmpdir := t.TempDir()
|
|
err := DownloadGameBananaMod("602180", tmpdir)
|
|
if err != nil {
|
|
t.Error("failed to download game banana mod", err)
|
|
}
|
|
|
|
// udate is the time the mod was last updated
|
|
// in unix time, used here as a version number
|
|
// modID@udate
|
|
expectedPathToExist := path.Join(tmpdir, "602180@1750696716")
|
|
|
|
if _, err := os.Stat(expectedPathToExist); err != nil {
|
|
t.Error("mod doesn't have expected name or doesn't exist")
|
|
}
|
|
}
|