Skip to content

Commit

Permalink
Use provider.getRegion() (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbstjn authored Jul 29, 2017
1 parent 8ca074a commit 4044546
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Plugin {
}

const alarms = this.serverless.service.custom['sqs-alarms'].map(
data => new Alarm(data, this.serverless.service.provider.region)
data => new Alarm(data, this.serverless.getProvider('aws').getRegion())
)

alarms.forEach(
Expand Down
9 changes: 5 additions & 4 deletions test/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Plugin = require('../')

it('creates CloudFormation configuration', () => {
let config = {
getProvider: () => ({ getRegion: () => 'test-region' }),
service: {
custom: {
'sqs-alarms': [
Expand All @@ -14,7 +15,6 @@ it('creates CloudFormation configuration', () => {
]
},
provider: {
region: 'test-region',
compiledCloudFormationTemplate: {
Resources: {}
}
Expand All @@ -39,6 +39,7 @@ describe('alarm name', () => {

beforeEach(() => {
config = {
getProvider: () => ({ getRegion: () => 'test-region' }),
service: {
custom: {
'sqs-alarms': [
Expand All @@ -49,7 +50,6 @@ describe('alarm name', () => {
]
},
provider: {
region: 'test-region',
compiledCloudFormationTemplate: {
Resources: {}
}
Expand Down Expand Up @@ -85,6 +85,7 @@ describe('alarm name', () => {

it('creates alarms for multiple queues', () => {
let config = {
getProvider: () => ({ getRegion: () => 'test-region' }),
service: {
custom: {
'sqs-alarms': [
Expand All @@ -101,7 +102,6 @@ it('creates alarms for multiple queues', () => {
]
},
provider: {
region: 'test-region',
compiledCloudFormationTemplate: {
Resources: {}
}
Expand All @@ -122,6 +122,7 @@ it('creates alarms for multiple queues', () => {

it('does not fail without configuration', () => {
let config = {
getProvider: () => ({ getRegion: () => 'test-region' }),
service: {
custom: { },
provider: {
Expand All @@ -145,6 +146,7 @@ describe('alarm treatMissingData', () => {

beforeEach(() => {
config = {
getProvider: () => ({ getRegion: () => 'test-region' }),
service: {
custom: {
'sqs-alarms': [
Expand All @@ -155,7 +157,6 @@ describe('alarm treatMissingData', () => {
]
},
provider: {
region: 'test-region',
compiledCloudFormationTemplate: {
Resources: {}
}
Expand Down

0 comments on commit 4044546

Please sign in to comment.