26 lines
6.7 KiB
Go
26 lines
6.7 KiB
Go
package gamebanana
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
)
|
|
|
|
func TestGetGameBananaModValid(t *testing.T) {
|
|
// mod: https://gamebanana.com/mods/409728
|
|
data, err := GetGameBananaMod("409728")
|
|
|
|
// data
|
|
compdata := `{"apps_used":"","authors":"{\"Key Author\":[[\"2VE\",\"Made the mod\",\"2329267\",\"\"]],\"Model Sources\":[[\" jc-starstorm\",\"Walter White\",\"0\",\"https:\\\/\\\/www.deviantart.com\\\/jc-starstorm\\\/art\\\/Walter-White-650574338\"],[\" SovietMentality\",\"Jesse Pinkman\",\"0\",\"https:\\\/\\\/www.deviantart.com\\\/sovietmentality\\\/art\\\/XNA-Breaking-Bad-Jesse-And-Skinny-Pete-DL-483365989\"]],\"Special Thanks\":[[\"Skyth\",\"DML, MMM and DBConverter\",\"1614680\",\"\"],[\"Bubble39\",\"DivaTableManager\",\"0\",\"\"]]}","Category().name":"Modules","catid":17293,"contestid":0,"creator":"true","Credits().aAuthors()":[["2VE","Made the mod","2329267",""],[" jc-starstorm","Walter White","0","https:\/\/www.deviantart.com\/jc-starstorm\/art\/Walter-White-650574338"],[" SovietMentality","Jesse Pinkman","0","https:\/\/www.deviantart.com\/sovietmentality\/art\/XNA-Breaking-Bad-Jesse-And-Skinny-Pete-DL-483365989"],["Skyth","DML, MMM and DBConverter","1614680",""],["Bubble39","DivaTableManager","0",""]],"Credits().aAuthorsAndGroups()":{"Key Author":[["2VE","Made the mod","2329267",""]],"Model Sources":[[" jc-starstorm","Walter White","0","https:\/\/www.deviantart.com\/jc-starstorm\/art\/Walter-White-650574338"],[" SovietMentality","Jesse Pinkman","0","https:\/\/www.deviantart.com\/sovietmentality\/art\/XNA-Breaking-Bad-Jesse-And-Skinny-Pete-DL-483365989"]],"Special Thanks":[["Skyth","DML, MMM and DBConverter","1614680",""],["Bubble39","DivaTableManager","0",""]]},"Credits().ssvAuthorNames()":"2VE jc-starstorm SovietMentality Skyth Bubble39","date":1667222980,"description":"Jesse, it's time to dance.","downloads":7339,"feedback_instructions":"","Files().aFiles()":{"884808":{"_idRow":"884808","_sFile":"breaking_bad.rar","_nFilesize":24933477,"_tsDateAdded":1667221651,"_nDownloadCount":7339,"_sDownloadUrl":"https:\/\/gamebanana.com\/dl\/884808","_sMd5Checksum":"0f38122833f1b73c0451c51b4381b301","_sAnalysisState":"done","_sAnalysisResult":"ok","_sAnalysisResultVerbose":"File passed preliminary analysis","_sAvState":"done","_sAvResult":"clean","_bIsArchived":false,"_bHasContents":true}},"Game().name":"Hatsune Miku: Project DIVA Mega Mix+","install_instructions":"","is_obsolete":"false","lastpost_date":1731516780,"lastpost_userid":3011973,"likes":42,"mdate":1667222980,"modnote":"","name":"Breaking Bad","Nsfw().bIsNsfw()":false,"obsol_notice":"","Owner().name":"2VE","postcount":17,"Posts().LastPost().idPosterRow()":3011973,"Posts().LastPost().sText()":"<p>BRBA IN DIVA!1!<\/p>","Posts().LastPost().tsDateAdded()":1731516780,"Posts().Postcount().nPostCount()":17,"Preview().sStructuredDataFullsizeUrl()":"https:\/\/gamebanana.com\/mods\/embeddables\/409728?variant=sd_image","Preview().sSubFeedImageUrl()":"https:\/\/images.gamebanana.com\/img\/ss\/mods\/220-90_635fc7a11487a.jpg","RootCategory().id":17315,"RootCategory().name":"Customization","screenshots":"[{\"_sCaption\":\"\",\"_sFile\":\"635fc7a11487a.jpg\",\"_nFilesize\":234709,\"_sFile220\":\"220-90_635fc7a11487a.jpg\",\"_hFile220\":124,\"_wFile220\":220,\"_sFile530\":\"530-90_635fc7a11487a.jpg\",\"_hFile530\":299,\"_wFile530\":530,\"_sFile100\":\"100-90_635fc7a11487a.jpg\",\"_hFile100\":56,\"_wFile100\":100,\"_sFile800\":\"800-90_635fc7a11487a.jpg\",\"_hFile800\":452,\"_wFile800\":800},{\"_sCaption\":\"\",\"_sFile\":\"635fc7d692f95.jpg\",\"_nFilesize\":390948,\"_sFile100\":\"100-90_635fc7d692f95.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc7e16fd2a.jpg\",\"_nFilesize\":398123,\"_sFile100\":\"100-90_635fc7e16fd2a.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc7eb51efb.jpg\",\"_nFilesize\":308231,\"_sFile100\":\"100-90_635fc7eb51efb.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc7f4e96f7.jpg\",\"_nFilesize\":316402,\"_sFile100\":\"100-90_635fc7f4e96f7.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc7ff0bc69.jpg\",\"_nFilesize\":272481,\"_sFile100\":\"100-90_635fc7ff0bc69.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc80915a9c.jpg\",\"_nFilesize\":215135,\"_sFile100\":\"100-90_635fc80915a9c.jpg\",\"_hFile100\":56,\"_wFile100\":100},{\"_sCaption\":\"\",\"_sFile\":\"635fc811375e5.jpg\",\"_nFilesize\":271437,\"_sFile100\":\"100-90_635fc811375e5.jpg\",\"_hFile100\":56,\"_wFile100\":100}]","studioid":0,"text":"<i>This mod ports Walter White and Jesse Pinkman from the hit TV series Breaking Bad\u2122!<br><\/i><br><br><i><b>Mod features<\/b>-<\/i><br><b>Added modules:<\/b> Both Walter and Jesse are their separate modules with their own portraits, so you can still use official modules without any conflicts.<br><b>Working expressions: <\/b>Yes, the lips move and will sing along to songs.<br><b>Funny:<\/b> This mod was initially made as a joke and tested on intel hd in 480p.<br><br><br><b>Compatibility and Known issues-<br><\/b>While this mod doesn't seem to conflict with official assets, the same cannot be said for the other mods on the site as I cannot test or adjust the files to account for mods other than my own.<br><br>And as for the issues-<br>Considering the nature of the mod (and it being my first for MM+), the character proportions might seem a bit off in some places. This is due to matching the proportions with the official models (or at least their bones), though the mod looks decent otherwise.<br><br><br><i>Thanks for reading.<\/i>","Trash().bIsTrashed()":false,"udate":1667222980,"Updates().aGetLatestUpdates()":[],"Updates().aLatestUpdates()":[],"Updates().bSubmissionHasUpdates()":false,"Updates().nUpdatesCount()":0,"Url().sDownloadUrl()":"https:\/\/gamebanana.com\/mods\/download\/409728","Url().sEditUrl()":"https:\/\/gamebanana.com\/mods\/edit\/409728","Url().sEmbeddablesUrl()":"https:\/\/gamebanana.com\/mods\/embeddables\/409728","Url().sHistoryUrl()":"https:\/\/gamebanana.com\/mods\/admin\/history\/409728","Url().sProfileUrl()":"https:\/\/gamebanana.com\/mods\/409728","Url().sTrashUrl()":"https:\/\/gamebanana.com\/mods\/admin\/trash\/409728","Url().sUntrashUrl()":"https:\/\/gamebanana.com\/mods\/admin\/untrash\/409728","Url().sUpdatesUrl()":"https:\/\/gamebanana.com\/mods\/updates\/409727","Url().sWithholdUrl()":"https:\/\/gamebanana.com\/mods\/admin\/withhold\/409728","userid":2329267,"views":53316,"Withhold().bIsWithheld()":false}`
|
|
|
|
var compDataStruct GameBananaMod
|
|
err = json.Unmarshal([]byte(compdata), &compDataStruct)
|
|
if err != nil {
|
|
t.Fatal("failed to unmarshal test comparison data")
|
|
}
|
|
|
|
if ! cmp.Equal(compDataStruct, data) {
|
|
t.Fatal("data recieved not same as expected data")
|
|
}
|
|
}
|