fixtures_test.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package server_test
  2. const actionStateSetValid = `
  3. {
  4. "type": "STATE_SET",
  5. "payload": {
  6. "songId": 123,
  7. "playing": true,
  8. "currentTime": 94,
  9. "seekTime": -1,
  10. "queue": [],
  11. "master": "some-master-client"
  12. }
  13. }
  14. `
  15. const actionStateSetIdNonPositive = `
  16. {
  17. "type": "STATE_SET",
  18. "payload": {
  19. "songId": 0,
  20. "playing": true,
  21. "currentTime": 94,
  22. "seekTime": -1,
  23. "queue": [],
  24. "master": "some-master-client"
  25. }
  26. }
  27. `
  28. const actionStateSetSongIdNull = `
  29. {
  30. "type": "STATE_SET",
  31. "payload": {
  32. "songId": null,
  33. "playing": false,
  34. "currentTime": 0,
  35. "seekTime": -1,
  36. "queue": [],
  37. "master": "some-master-client"
  38. }
  39. }
  40. `
  41. const actionStateSetCurrentTimeNegative = `
  42. {
  43. "type": "STATE_SET",
  44. "payload": {
  45. "songId": 123,
  46. "playing": false,
  47. "currentTime": -32,
  48. "seekTime": -1,
  49. "queue": [],
  50. "master": "some-master-client"
  51. }
  52. }
  53. `
  54. const actionStateSetSeekTimeTooNegative = `
  55. {
  56. "type": "STATE_SET",
  57. "payload": {
  58. "songId": 123,
  59. "playing": false,
  60. "currentTime": 13,
  61. "seekTime": -3,
  62. "queue": [],
  63. "master": "some-master-client"
  64. }
  65. }
  66. `
  67. const actionStateSetMasterEmpty = `
  68. {
  69. "type": "STATE_SET",
  70. "payload": {
  71. "songId": 123,
  72. "playing": false,
  73. "currentTime": 13,
  74. "seekTime": -3,
  75. "queue": [],
  76. "master": ""
  77. }
  78. }
  79. `
  80. // CLIENT_LIST_UPDATED should only ever come from the server
  81. const actionUnrecognised = `
  82. {
  83. "type": "CLIENT_LIST_UPDATED",
  84. "payload": [
  85. { "name": "client-a", "lastPing": 123 },
  86. { "name": "client-b", "lastPing": 456 }
  87. ]
  88. }
  89. `