feat: allow setting of global fallback user agent (#18016)

* feat: allow setting of global fallback user agent

* spec: add tests for app.set/getUserAgentFallback
This commit is contained in:
Samuel Attard 2019-05-01 16:34:42 -07:00 committed by GitHub
parent 649d7c0d9e
commit d4f5ebefe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 5 deletions

View file

@ -1296,6 +1296,30 @@ describe('default behavior', () => {
expect(result).to.equal(true)
})
})
describe('user agent fallback', () => {
let initialValue: string
before(() => {
initialValue = app.userAgentFallback!
})
it('should have a reasonable default', () => {
expect(initialValue).to.include(`Electron/${process.versions.electron}`)
expect(initialValue).to.include(`Chrome/${process.versions.chrome}`)
})
it('should be overridable', () => {
app.userAgentFallback = 'test-agent/123'
expect(app.userAgentFallback).to.equal('test-agent/123')
})
it('should be restorable', () => {
app.userAgentFallback = 'test-agent/123'
app.userAgentFallback = ''
expect(app.userAgentFallback).to.equal(initialValue)
})
})
})
async function runTestApp (name: string, ...args: any[]) {