GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.7 KiB

  1. package forumlog_test
  2. import (
  3. "strings"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. "git.aiterp.net/rpdata/api/internal/importers/forumlog"
  7. )
  8. func TestParseMetadata(t *testing.T) {
  9. data := forumlog.ParseMetadata(testData1)
  10. assert.Equal(t, data["Date"], []string{
  11. "August 11, 2014",
  12. "August 12, 2014",
  13. "August 13, 2014",
  14. })
  15. assert.Equal(t, data["Location"], []string{
  16. "Aroste, an island off the Derraian coastline.",
  17. })
  18. assert.Equal(t, data["GM"], []string{
  19. "Gisle",
  20. })
  21. assert.Equal(t, data["Length"], []string{
  22. "847 posts",
  23. })
  24. assert.Equal(t, len(data["Stuff"]), 0)
  25. for key := range data {
  26. if strings.HasPrefix(key, "[") {
  27. t.Error("It should have stopped at the IRC post, yet this key exists:", key)
  28. }
  29. }
  30. }
  31. var testData1 = `
  32. Date: August 2185
  33. August 11, 2014
  34. August 12, 2014
  35. August 13, 2014
  36. Location:
  37. Aroste, an island off the Derraian coastline.
  38. GM:
  39. Gisle
  40. Length:
  41. 847 posts
  42. Characters:
  43. Calyx Vadris - Osiris
  44. Damien Monroe - Bowe
  45. Jason Wolfe - Dante
  46. Renala T'Iavay - Gisle
  47. Victoria Steels - MCB280
  48. NPCs:
  49. Recurring:
  50. Halisi - Tyranniac
  51. Jattic - Dante
  52. Jelvan Darennon - Gisle
  53. Leah - Dante
  54. Marissa T'Evin - Gisle
  55. Philip Lacour - Tyranniac
  56. One-off:
  57. Reidas Falten (Turian - Guard meeting them on their trip to the building)
  58. Sarian T'Dera (Asari - Asari opening fire on Calyx, Leah and Renala)
  59. Mariam Adams (Human - The receptionist.)
  60. Prerix Falten (Turian2 - Victoria's chair)
  61. Jonathan Lyng (OtherHuman - The one opening fire on Leah entering the garage)
  62. Alerena Teris (Teris - Asari met in the maintenance corridor)
  63. <-- Redorck Agency - August 11, 2014
  64. [13:19] * Leah looks over at Damien. "Haven't seen you around the agency." she says curiously, "New hire?"
  65. `