|
|
package forumlog_test
import ( "strings" "testing"
"github.com/stretchr/testify/assert"
"git.aiterp.net/rpdata/api/internal/importers/forumlog" )
func TestParseMetadata(t *testing.T) { data := forumlog.ParseMetadata(testData1)
assert.Equal(t, data["Date"], []string{ "August 11, 2014", "August 12, 2014", "August 13, 2014", }) assert.Equal(t, data["Location"], []string{ "Aroste, an island off the Derraian coastline.", }) assert.Equal(t, data["GM"], []string{ "Gisle", }) assert.Equal(t, data["Length"], []string{ "847 posts", }) assert.Equal(t, len(data["Stuff"]), 0)
for key := range data { if strings.HasPrefix(key, "[") { t.Error("It should have stopped at the IRC post, yet this key exists:", key) } } }
var testData1 = ` Date: August 2185 August 11, 2014 August 12, 2014 August 13, 2014
Location: Aroste, an island off the Derraian coastline.
GM: Gisle
Length: 847 posts
Characters: Calyx Vadris - Osiris Damien Monroe - Bowe Jason Wolfe - Dante Renala T'Iavay - Gisle Victoria Steels - MCB280
NPCs: Recurring: Halisi - Tyranniac Jattic - Dante Jelvan Darennon - Gisle Leah - Dante Marissa T'Evin - Gisle Philip Lacour - Tyranniac
One-off: Reidas Falten (Turian - Guard meeting them on their trip to the building) Sarian T'Dera (Asari - Asari opening fire on Calyx, Leah and Renala) Mariam Adams (Human - The receptionist.) Prerix Falten (Turian2 - Victoria's chair) Jonathan Lyng (OtherHuman - The one opening fire on Leah entering the garage) Alerena Teris (Teris - Asari met in the maintenance corridor)
<-- Redorck Agency - August 11, 2014
[13:19] * Leah looks over at Damien. "Haven't seen you around the agency." she says curiously, "New hire?"
`
|