-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Showing
3 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,46 @@ | ||
/** | ||
* Wechaty - Wechat for Bot. Connecting ChatBots | ||
* | ||
* Licenst: ISC | ||
* https://github.com/wechaty/wechaty | ||
* | ||
*/ | ||
import { test } from 'ava' | ||
|
||
import { | ||
BrowserCookie | ||
} from './browser-cookie' | ||
|
||
import { BrowserDriver } from './browser-driver' | ||
|
||
test('hostname() for wx.qq.com', async t => { | ||
const driver = <BrowserDriver>{} | ||
const browserCookie = new BrowserCookie(driver, 'test/fixture/profile/qq.wechaty.json') | ||
const hostname = await browserCookie.hostname() | ||
|
||
t.is(hostname, 'wx.qq.com', 'should get wx.qq.com') | ||
}) | ||
|
||
test('hostname() for wechat.com', async t => { | ||
const driver = <BrowserDriver>{} | ||
const browserCookie = new BrowserCookie(driver, 'test/fixture/profile/wechat.wechaty.json') | ||
const hostname = await browserCookie.hostname() | ||
|
||
t.is(hostname, 'wechat.com', 'should get wechat.com') | ||
}) | ||
|
||
test('hostname() for default', async t => { | ||
const driver = <BrowserDriver>{} | ||
const browserCookie = new BrowserCookie(driver) | ||
const hostname = await browserCookie.hostname() | ||
|
||
t.is(hostname, 'wx.qq.com', 'should get wx.qq.com') | ||
}) | ||
|
||
test('hostname() for file not exist', async t => { | ||
const driver = <BrowserDriver>{} | ||
const browserCookie = new BrowserCookie(driver, 'file-not-exist.wechaty.json') | ||
const hostname = await browserCookie.hostname() | ||
|
||
t.is(hostname, 'wx.qq.com', 'should get wx.qq.com for non exist file') | ||
}) |
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 @@ | ||
[{"domain":".qq.com","expiry":2147385600,"httpOnly":false,"name":"pgv_pvi","path":"/","secure":false,"value":"8512099328"},{"domain":".qq.com","httpOnly":false,"name":"pgv_si","path":"/","secure":false,"value":"s5248662528"},{"domain":".wx.qq.com","expiry":1482380243,"httpOnly":false,"name":"mm_lang","path":"/","secure":false,"value":"en"}] |
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 @@ | ||
[{"domain":".wechat.com","expiry":1482380361,"httpOnly":false,"name":"mm_lang","path":"/","secure":false,"value":"en_US"},{"domain":".wechat.com","expiry":1797697161,"httpOnly":false,"name":"webwx_auth_ticket","path":"/","secure":false,"value":"CIsBEIW4yZYPGoABjgOYg33uUb4ct38aQsfT/zJ8FDNF8yKX4o4sJT7aVXjvBUjBLC/SXBj38TSCEmWsK8DME2FzDUl4kS2vXalfNnAFdScEuveH/h7T2CbHbvv5O4fDfxW2Olb5OQoWLrS61Wkx0XjghelAhyusVCGHiRVTtHaCx4gfyHk4 QyRiYc="},{"domain":".wechat.com","expiry":1797697161,"httpOnly":false,"name":"webwxuvid","path":"/","secure":false,"value":"e2108c64dbecd6ea0e3bc7a0266f467dcc63350fbc55559cdf6c25afd6f8bd88c7216d3aaec6427e41c2b918872bb549"},{"domain":".wechat.com","expiry":1482380361,"httpOnly":false,"name":"webwx_data_ticket","path":"/","secure":false,"value":"gScvXIoeHANgdX4Dq5kOjAGY"},{"domain":".wechat.com","httpOnly":false,"name":"pgv_si","path":"/","secure":false,"value":"s4528565248"},{"domain":".wechat.com","expiry":1482380361,"httpOnly":false,"name":"wxloadtime","path":"/","secure":false,"value":"1482337161"},{"domain":".wechat.com","expiry":1482380361,"httpOnly":false,"name":"wxsid","path":"/","secure":false,"value":"GURmztH40ijJuL3f"},{"domain":".wechat.com","expiry":2147385600,"httpOnly":false,"name":"pgv_pvi","path":"/","secure":false,"value":"6397004800"},{"domain":".wechat.com","expiry":1482380361,"httpOnly":false,"name":"wxuin","path":"/","secure":false,"value":"278208447"}] |