mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Add tests
This commit is contained in:
parent
e2d34723e5
commit
06f1cdbe51
1 changed files with 30 additions and 1 deletions
|
@ -51,7 +51,7 @@ describe('utils.generateProxyURL', () => {
|
|||
expect(doipjs.utils.generateProxyURL).to.be.a('function')
|
||||
expect(doipjs.utils.generateProxyURL).to.have.length(3)
|
||||
})
|
||||
it('should generate correct proxy URLs', () => {
|
||||
it('should generate correct proxy URLs for explicit https scheme', () => {
|
||||
const opts = {
|
||||
proxy: {
|
||||
hostname: 'localhost',
|
||||
|
@ -65,6 +65,35 @@ describe('utils.generateProxyURL', () => {
|
|||
doipjs.utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
||||
).to.equal('https://localhost/api/2/get/dns?domain=domain.org')
|
||||
})
|
||||
it('should generate correct proxy URLs for explicit http scheme', () => {
|
||||
const opts = {
|
||||
proxy: {
|
||||
hostname: 'localhost',
|
||||
scheme: 'http'
|
||||
},
|
||||
}
|
||||
expect(
|
||||
doipjs.utils.generateProxyURL('http', { domain: 'domain.org' }, opts)
|
||||
).to.equal('http://localhost/api/2/get/http?domain=domain.org')
|
||||
expect(
|
||||
doipjs.utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
||||
).to.equal('http://localhost/api/2/get/dns?domain=domain.org')
|
||||
})
|
||||
it('should generate correct proxy URLs for default scheme', () => {
|
||||
const opts = {
|
||||
proxy: {
|
||||
hostname: 'localhost'
|
||||
},
|
||||
}
|
||||
expect(
|
||||
doipjs.utils.generateProxyURL('http', { domain: 'domain.org' }, opts)
|
||||
).to.equal('https://localhost/api/2/get/http?domain=domain.org')
|
||||
expect(
|
||||
doipjs.utils.generateProxyURL('dns', { domain: 'domain.org' }, opts)
|
||||
).to.equal('https://localhost/api/2/get/dns?domain=domain.org')
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
describe('utils.getUriFromString', () => {
|
||||
|
|
Loading…
Reference in a new issue