feat: add API to check if session is persistent (#22622)
This commit is contained in:
parent
19314d3caf
commit
34e004015d
4 changed files with 37 additions and 0 deletions
|
@ -898,6 +898,30 @@ describe('session module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('ses.isPersistent()', () => {
|
||||
afterEach(closeAllWindows)
|
||||
|
||||
it('returns default session as persistent', () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false
|
||||
})
|
||||
|
||||
const ses = w.webContents.session
|
||||
|
||||
expect(ses.isPersistent()).to.be.true()
|
||||
})
|
||||
|
||||
it('returns persist: session as persistent', () => {
|
||||
const ses = session.fromPartition(`persist:${Math.random()}`)
|
||||
expect(ses.isPersistent()).to.be.true()
|
||||
})
|
||||
|
||||
it('returns temporary session as not persistent', () => {
|
||||
const ses = session.fromPartition(`${Math.random()}`)
|
||||
expect(ses.isPersistent()).to.be.false()
|
||||
})
|
||||
})
|
||||
|
||||
describe('ses.setUserAgent()', () => {
|
||||
afterEach(closeAllWindows)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue