fixtures_test.go 1.7 KB

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