Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

login.service.spec.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import test from 'ava'
  2. import { Login } from '../src/services/login.service.js'
  3. test('Make sure we can instantiate login service', async t => {
  4. const currentProfile = new Login()
  5. t.is(currentProfile.isLoggedIn, false)
  6. t.is(currentProfile.isComplete, false)
  7. t.is(currentProfile.hasResponses, 0)
  8. currentProfile.id.value = 99
  9. currentProfile._loading.value = false
  10. t.is(currentProfile.isLoggedIn, true)
  11. })
  12. test('Make sure login.tags can be set', async t => {
  13. const currentProfile = new Login()
  14. const testTags = ['x', 'y', 'z']
  15. currentProfile.setTags(testTags)
  16. t.is(currentProfile.tags, testTags)
  17. })
  18. test('Make sure login.responses can be set', async t => {
  19. const currentProfile = new Login()
  20. const testResponses = ['100', '200', '300']
  21. currentProfile.setResponses(testResponses)
  22. t.is(currentProfile.responses, testResponses)
  23. })
  24. test('Make sure login.groupings work correctly', async t => {
  25. const currentProfile = new Login()
  26. const testGroupings = [
  27. { name: 'a', is_paired: false },
  28. { name: 'b', is_paired: false },
  29. { name: 'c', is_paired: true },
  30. ]
  31. currentProfile.groupings = testGroupings
  32. t.deepEqual(
  33. currentProfile.pendingGroupings.map(g => g.name),
  34. ['a', 'b'],
  35. )
  36. t.deepEqual(
  37. currentProfile.pairedGroupings.map(g => g.name),
  38. ['c'],
  39. )
  40. })
  41. test('Make sure login.logout() works', async t => {
  42. const currentProfile = new Login()
  43. currentProfile.id.value = 99
  44. currentProfile.toaster = { name: 'dummy_toaster', stop: () => {} }
  45. currentProfile.chatter = { name: 'dummy_chatter', stop: () => {} }
  46. t.is(currentProfile.chatter.name, 'dummy_chatter')
  47. currentProfile.logout()
  48. t.is(currentProfile.id.value, null)
  49. })