Skip to content

Commit

Permalink
Merge pull request #553 from vultr/issue-550
Browse files Browse the repository at this point in the history
#550 fix missing request type in bare-metals, add test case to avoid future issues
  • Loading branch information
spencerkordecki authored Dec 3, 2021
2 parents c703cd1 + 35d88a3 commit 3344cde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/bare-metal.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ exports.deleteInstance = {
*/
exports.getInstanceIpv4Addresses = {
url: '/bare-metals/{baremetal-id}/ipv4',
requestType: '',
requestType: 'GET',
apiKeyRequired: true,
parameters: {
'baremetal-id': {
Expand Down
5 changes: 5 additions & 0 deletions test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports.createTestSuite = (specificationFile, mockParameters, mockResponse) => {
const apiModule = specificationFile.replace(/-([a-z])/g, function (str) {
return str[1].toUpperCase()
})
const validRequestTypes = ['GET', 'POST', 'PATCH', 'PUT', 'DELETE']

jest.mock('node-fetch', () => jest.fn())

Expand All @@ -25,6 +26,10 @@ exports.createTestSuite = (specificationFile, mockParameters, mockResponse) => {
}
}

it('has a valid request type', () => {
expect(validRequestTypes.includes(endpoint.requestType)).toEqual(true)
})

if (endpoint.apiKeyRequired) {
it('requires an API key', () => {
const vultrInstance = vultr.initialize()
Expand Down

0 comments on commit 3344cde

Please sign in to comment.