This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt Seccafien
committed
Sep 24, 2019
1 parent
ccccbc6
commit 969324c
Showing
11 changed files
with
92 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/react-network/src/test/ServerCookieManager.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {ServerCookieManager} from '../ServerCookieManager'; | ||
|
||
describe('NetworkManager', () => { | ||
it('returns all cookies as an object', () => { | ||
const cookies = 'foo=bar;baz=qux'; | ||
const manager = new ServerCookieManager(cookies); | ||
|
||
expect(manager.getCookies()).toStrictEqual({ | ||
baz: { | ||
value: 'qux', | ||
}, | ||
foo: { | ||
value: 'bar', | ||
}, | ||
}); | ||
}); | ||
|
||
it('sets additional cookies', () => { | ||
const cookies = 'foo=bar;baz=qux'; | ||
const manager = new ServerCookieManager(cookies); | ||
|
||
manager.setCookie('quux', 'quuz'); | ||
expect(manager.getCookies()).toStrictEqual({ | ||
baz: { | ||
value: 'qux', | ||
}, | ||
foo: { | ||
value: 'bar', | ||
}, | ||
quux: { | ||
value: 'quuz', | ||
}, | ||
}); | ||
}); | ||
|
||
it('returns an individual cookie value from a given key', () => { | ||
const cookies = 'foo=bar;baz=qux'; | ||
const manager = new ServerCookieManager(cookies); | ||
|
||
expect(manager.getCookie('foo')).toBe('bar'); | ||
expect(manager.getCookie('baz')).toBe('qux'); | ||
}); | ||
|
||
it('removes an individual cookie from a given key', () => { | ||
const cookies = 'foo=bar;baz=qux'; | ||
const manager = new ServerCookieManager(cookies); | ||
manager.removeCookie('foo'); | ||
|
||
expect(manager.getCookies().foo).toMatchObject({ | ||
expires: new Date('Thu, 01 Jan 1970 00:00:01 GMT'), | ||
value: '', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters