Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. var allCookies = [];
  2. function getAllCookies() {
  3. chrome.cookies.getAll({}, function(cookies) {
  4. for (var i in cookies) {
  5. allCookies.push(cookies[i])
  6. }
  7. }
  8. });
  9. }
  10.  
  11. describe('getAllCookies', function() {
  12. beforeEach(function() {
  13. chrome = {
  14. cookies: {
  15. getAll : function() {
  16. return [
  17. 'cookie1',
  18. 'cookie2'
  19. ]
  20. }
  21. }
  22. };
  23. spyOn(chrome.cookies,'getAll');
  24. });
  25. it('should updated global variable allCookies', function() {
  26. getAllCookies();
  27. expect(allCookies).toEqual(['cookie1','cookie2'])
  28. })
  29. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement