Browse Source

test: add test for invalid cookie url (#19568)

Micha Hanselmann 5 years ago
parent
commit
f2f483fedb
1 changed files with 10 additions and 0 deletions
  1. 10 0
      spec/api-session-spec.js

+ 10 - 0
spec/api-session-spec.js

@@ -145,6 +145,16 @@ describe('session module', () => {
       expect(error).to.have.property('message').which.equals('Failed to get cookie domain')
     })
 
+    it('yields an error when setting a cookie with an invalid URL', async () => {
+      const { cookies } = session.defaultSession
+      const name = '1'
+      const value = '1'
+
+      await expect(
+        cookies.set({ url: 'asdf', name, value })
+      ).to.eventually.be.rejectedWith('Failed to get cookie domain')
+    })
+
     it('should overwrite previous cookies', async () => {
       let error
       try {