Guest User

Untitled

a guest
Sep 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. [In reply to Oim Trust]
  2. describe('GET: /user/login', () => {
  3.  
  4. it('Should return success GET status', () => {
  5. return $http.post('/user/login', {
  6. email: 'adith@gmail.com',
  7. password: 'adith123'
  8. })
  9. .then(response => {
  10. response.status.should.equal(200);
  11. })
  12. });
  13.  
  14. it('Should return fail GET status, because email or password is incorrect', () => {
  15. return $http.post('/user/login', {
  16. email: 'adith@gmail.com',
  17. password: 'wR0n6_P4A55WoRd'
  18. })
  19. .catch(err => {
  20. let failAuthState = err.data;
  21. authState.should.have.property('message').and.to.be.a('string');
  22. })
  23.  
  24. });
  25.  
  26. it(`Should return true because have 'email:' property`, () => {
  27. return $http.post('/user/login', {
  28. email: 'adith@gmail.com',
  29. password: 'adith123'
  30. })
  31. .then(response => {
  32. let authState = response.data;
  33. authState.should.have.property('email').and.to.be.a('string');
  34. })
  35. })
  36.  
  37. it(`Should return true because have 'email:' property and have '@'`, () => {
  38. return $http.post('/user/login', {
  39. email: 'adith@gmail.com',
  40. password: 'adith123'
  41. })
  42. .then(response => {
  43. let authState = response.data;
  44. authState.should.have.property('email').and.have.string('@');
  45. })
  46. })
  47.  
  48. it(`Should return true because have 'providerData:' property`, () => {
  49. return $http.post('/user/login', {
  50. email: 'adith@gmail.com',
  51. password: 'adith123'
  52. })
  53. .then(response => {
  54. let authState = response.data;
  55. authState.should.have.property('providerData').and.to.be.an('array');
  56. })
  57. })
  58.  
  59. it(`Should return true because have 'providerData:' property and have certain length`, () => {
  60. return $http.post('/user/login', {
  61. email: 'adith@gmail.com',
  62. password: 'adith123'
  63. })
  64. .then(response => {
  65. let authState = response.data;
  66. authState.should.have.property('providerData').and.to.be.an('array').and.to.have.lengthOf(1);
  67. })
  68. })
  69.  
  70. it(`Should return true because have 'emailVerified:' property and valued false`, () => {
  71. return $http.post('/user/login', {
  72. email: 'adith@gmail.com',
  73. password: 'adith123'
  74. })
  75. .then(response => {
  76. let authState = response.data;
  77. authState.should.have.property('emailVerified').and.to.be.false;
  78. })
  79. })
  80.  
  81. it(`Should return true because have 'displayName:' property and valued null because app doesn't allow full name`, () => {
  82. return $http.post('/user/login', {
  83. email: 'adith@gmail.com',
  84. password: 'adith123'
  85. })
  86. .then(response => {
  87. let authState = response.data;
  88. authState.should.have.property('displayName').and.to.be.null;
  89. })
  90. })
  91.  
  92. it(`Should return true because have 'stsTokenManager:' property and is and object that contains importan objects`, () => {
  93. return $http.post('/user/login', {
  94. email: 'adith@gmail.com',
  95. password: 'adith123'
  96. })
  97. .then(response => {
  98. let authState = response.data;
  99. authState.should.have.property('stsTokenManager').and.to.be.an('object')
  100. })
  101. })
  102.  
  103. it(`Should return true because have 'apiKey: and accessToken:' property inside stsTokenManager object`, () => {
  104. return $http.post('/user/login', {
  105. email: 'adith@gmail.com',
  106. password: 'adith123'
  107. })
  108. .then(response => {
  109. let authState = response.data.stsTokenManager;
  110. authState.should.have.property('apiKey')
  111. authState.should.have.property('accessToken')
  112. })
  113. })
  114.  
  115. });
Add Comment
Please, Sign In to add comment