aws-subdomain
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -5,3 +5,2 @@ 'use strict'; | ||
type = type || 'CREATE'; | ||
type = type.toUpperCase(); | ||
@@ -11,2 +10,5 @@ if (arguments.length === 2) { | ||
baseDomain = type; | ||
type = 'CREATE'; | ||
} else { | ||
type = type.toUpperCase(); | ||
} | ||
@@ -13,0 +15,0 @@ |
@@ -58,3 +58,3 @@ 'use strict'; | ||
var api = this.api; | ||
var domainDetails = splitDomain(newDomain); | ||
var domainDetails = splitDomain(existingDomain); | ||
var params = extend({}, baseParams); | ||
@@ -61,0 +61,0 @@ var rootDomain = domainDetails.root; |
'use strict'; | ||
module.exports = function (verboseId) { | ||
var split = verboseId.split('/'); | ||
if (!split || !split.length) { | ||
if (!verboseId) { | ||
return; | ||
} | ||
var split = verboseId.split('/'); | ||
return split.slice(-1)[0]; | ||
}; |
{ | ||
"name": "aws-subdomain", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Create subdomains for AWS without diving into the AWS SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
@@ -16,2 +16,16 @@ 'use strict'; | ||
test('hosted zone id - not set', function (t) { | ||
var id = splitZoneId(); | ||
t.equal(id, undefined); | ||
t.end(); | ||
}); | ||
test('hosted zone id - weird', function (t) { | ||
var id = splitZoneId('/'); | ||
t.equal(id, ''); | ||
t.end(); | ||
}); | ||
test('domain split', function (t) { | ||
@@ -46,1 +60,20 @@ var split = splitDomain('my.super.fancy.domain.com'); | ||
}); | ||
test('create correct change object - no type', function (t) { | ||
var change = createChange('beta.blob.com', 'test1'); | ||
t.same(change, { | ||
Action: 'CREATE', | ||
ResourceRecordSet: { | ||
Name: 'test1.beta.blob.com', | ||
Type: 'CNAME', | ||
ResourceRecords: [ | ||
{ | ||
Value: 'beta.blob.com' | ||
}, | ||
], | ||
TTL: 3600 | ||
} | ||
}); | ||
t.end(); | ||
}); |
11544
244