-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(readBackends): Add readBackends class method
Add readBackends class method to list all backends for a particular service and version
- Loading branch information
1 parent
65f231a
commit 9e41fb5
Showing
17 changed files
with
189 additions
and
17 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 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use strict'; | ||
|
||
const nock = require('nock'); | ||
const expect = require('expect'); | ||
const config = require('../src/config'); | ||
const fastlyPromises = require('../src/index'); | ||
const response = require('./response/readBackends.response'); | ||
|
||
describe('#readBackends', () => { | ||
const fastly = fastlyPromises('923b6bd5266a7f932e41962755bd4254', 'SU1Z0isxPaozGVKXdv0eY'); | ||
let res; | ||
|
||
nock(config.mainEntryPoint) | ||
.get('/service/SU1Z0isxPaozGVKXdv0eY/version/234/backend') | ||
.reply(200, response.readBackends); | ||
|
||
before(async () => { | ||
res = await fastly.readBackends('234'); | ||
}); | ||
|
||
it('response should be a status 200', () => { | ||
expect(res.status).toBe(200); | ||
}); | ||
|
||
it('response body should exist', () => { | ||
expect(res.data).toExist(); | ||
}); | ||
|
||
it('response body should be an array', () => { | ||
expect(Array.isArray(res.data)).toBe(true); | ||
}); | ||
|
||
it('response body should be an array of objects', () => { | ||
res.data.forEach(item => { | ||
expect(item).toBeA('object'); | ||
}); | ||
}); | ||
|
||
it('response body should contain all properties', () => { | ||
res.data.forEach(item => { | ||
expect(item).toIncludeKeys([ | ||
'max_tls_version', | ||
'ssl_client_cert', | ||
'hostname', | ||
'error_threshold', | ||
'first_byte_timeout', | ||
'client_cert', | ||
'weight', | ||
'address', | ||
'updated_at', | ||
'connect_timeout', | ||
'ipv4', | ||
'ssl_ciphers', | ||
'name', | ||
'port', | ||
'between_bytes_timeout', | ||
'ssl_client_key', | ||
'ssl_ca_cert', | ||
'auto_loadbalance', | ||
'ssl_check_cert', | ||
'shield', | ||
'service_id', | ||
'request_condition', | ||
'ssl_cert_hostname', | ||
'ssl_hostname', | ||
'ssl_sni_hostname', | ||
'locked', | ||
'min_tls_version', | ||
'ipv6', | ||
'version', | ||
'deleted_at', | ||
'healthcheck', | ||
'max_conn', | ||
'use_ssl', | ||
'created_at', | ||
'comment' | ||
]); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
module.exports.readBackends = [ | ||
{ | ||
'max_tls_version': null, | ||
'ssl_client_cert': null, | ||
'hostname': null, | ||
'error_threshold': 0, | ||
'first_byte_timeout': 30000, | ||
'client_cert': null, | ||
'weight': 100, | ||
'address': '127.0.0.1', | ||
'updated_at': '2017-11-03T17:30:07Z', | ||
'connect_timeout': 30000, | ||
'ipv4': null, | ||
'ssl_ciphers': null, | ||
'name': 'backend-name', | ||
'port': 80, | ||
'between_bytes_timeout': 10000, | ||
'ssl_client_key': null, | ||
'ssl_ca_cert': null, | ||
'auto_loadbalance': false, | ||
'ssl_check_cert': true, | ||
'shield': 'sea-wa-us', | ||
'service_id': 'SU1Z0isxPaozGVKXdv0eY', | ||
'request_condition': '', | ||
'ssl_cert_hostname': null, | ||
'ssl_hostname': null, | ||
'ssl_sni_hostname': null, | ||
'locked': true, | ||
'min_tls_version': null, | ||
'ipv6': null, | ||
'version': 234, | ||
'deleted_at': null, | ||
'healthcheck': null, | ||
'max_conn': 200, | ||
'use_ssl': false, | ||
'created_at': '2017-03-07T21:56:38Z', | ||
'comment': '' | ||
} | ||
]; |
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