diff --git a/packages/compute/test/zone.js b/packages/compute/test/zone.js index 78f911bf2b8..5f92235ee17 100644 --- a/packages/compute/test/zone.js +++ b/packages/compute/test/zone.js @@ -182,7 +182,7 @@ describe('Zone', function() { it('should throw if a target is not provided', function() { assert.throws(function() { zone.createAutoscaler(NAME, {}, assert.ifError); - }, 'Cannot create an autoscaler without a target.'); + }, /Cannot create an autoscaler without a target\./); }); it('should make the correct request', function(done) { diff --git a/packages/datastore/test/request.js b/packages/datastore/test/request.js index 39ce7c01f2d..071106e8549 100644 --- a/packages/datastore/test/request.js +++ b/packages/datastore/test/request.js @@ -1305,7 +1305,7 @@ describe('Request', function() { assert.throws(function() { request.request_({ method: 'runQuery' }, reqOpts, assert.ifError); - }, 'Read consistency cannot be specified in a transaction.'); + }, /Read consistency cannot be specified in a transaction\./); }); }); }); diff --git a/packages/logging/test/index.js b/packages/logging/test/index.js index 92e3e3aa7c1..c161064c693 100644 --- a/packages/logging/test/index.js +++ b/packages/logging/test/index.js @@ -170,13 +170,13 @@ describe('Logging', function() { it('should throw if a name is not provided', function() { assert.throws(function() { logging.createSink(); - }, 'A sink name must be provided.'); + }, /A sink name must be provided\./); }); it('should throw if a config object is not provided', function() { assert.throws(function() { logging.createSink(SINK_NAME); - }, 'A sink configuration object must be provided.'); + }, /A sink configuration object must be provided\./); }); it('should set acls for a Bucket destination', function(done) { diff --git a/packages/prediction/test/index.js b/packages/prediction/test/index.js index 7e5e4f27e44..283c418ee04 100644 --- a/packages/prediction/test/index.js +++ b/packages/prediction/test/index.js @@ -128,7 +128,7 @@ describe('Prediction', function() { it('should throw if a model ID is not provided', function() { assert.throws(function() { prediction.createModel(); - }, /A model ID is required/); + }, /A model ID is required\./); }); it('should make the correct API request', function(done) { @@ -379,7 +379,7 @@ describe('Prediction', function() { it('should throw if a name is not provided', function() { assert.throws(function() { prediction.model(); - }, /A model ID is required/); + }, /A model ID is required\./); }); it('should return a Model', function() { diff --git a/packages/pubsub/test/iam.js b/packages/pubsub/test/iam.js index c1478de42fa..dc394497ddb 100644 --- a/packages/pubsub/test/iam.js +++ b/packages/pubsub/test/iam.js @@ -93,7 +93,7 @@ describe('IAM', function() { it('should throw an error if a policy is not supplied', function() { assert.throws(function() { iam.setPolicy(util.noop); - }, /A policy object is required/); + }, /A policy object is required\./); }); it('should make the correct API request', function(done) { @@ -117,7 +117,7 @@ describe('IAM', function() { it('should throw an error if permissions are missing', function() { assert.throws(function() { iam.testPermissions(util.noop); - }, /Permissions are required/); + }, /Permissions are required\./); }); it('should make the correct API request', function(done) { diff --git a/packages/pubsub/test/index.js b/packages/pubsub/test/index.js index 0879562d14f..f4c72c91947 100644 --- a/packages/pubsub/test/index.js +++ b/packages/pubsub/test/index.js @@ -468,13 +468,13 @@ describe('PubSub', function() { it('should throw if no Topic is provided', function() { assert.throws(function() { pubsub.subscribe(); - }, /A Topic is required.*/); + }, /A Topic is required for a new subscription\./); }); it('should throw if no sub name is provided', function() { assert.throws(function() { pubsub.subscribe('topic'); - }, /A subscription name is required.*/); + }, /A subscription name is required for a new subscription\./); }); it('should not require configuration options', function(done) { @@ -680,7 +680,7 @@ describe('PubSub', function() { it('should throw if no name is provided', function() { assert.throws(function() { pubsub.subscription(); - }, /The name of a subscription is required/); + }, /The name of a subscription is required\./); }); it('should return a Subscription object', function() { @@ -716,7 +716,7 @@ describe('PubSub', function() { it('should throw if a name is not provided', function() { assert.throws(function() { pubsub.topic(); - }, /name must be specified/); + }, /A name must be specified for a new topic\./); }); it('should return a Topic object', function() { diff --git a/packages/pubsub/test/subscription.js b/packages/pubsub/test/subscription.js index 4c35a7f80d7..e7dbc5d2dcd 100644 --- a/packages/pubsub/test/subscription.js +++ b/packages/pubsub/test/subscription.js @@ -258,10 +258,10 @@ describe('Subscription', function() { it('should throw if no IDs are provided', function() { assert.throws(function() { subscription.ack(); - }, /At least one ID/); + }, /At least one ID must be specified before it can be acknowledged\./); assert.throws(function() { subscription.ack([]); - }, /At least one ID/); + }, /At least one ID must be specified before it can be acknowledged\./); }); it('should accept a single id', function() { diff --git a/packages/pubsub/test/topic.js b/packages/pubsub/test/topic.js index 767c95d2a39..1b2868a74a9 100644 --- a/packages/pubsub/test/topic.js +++ b/packages/pubsub/test/topic.js @@ -185,17 +185,17 @@ describe('Topic', function() { it('should throw if no message is provided', function() { assert.throws(function() { topic.publish(); - }, /Cannot publish without a message/); + }, /Cannot publish without a message\./); assert.throws(function() { topic.publish([]); - }, /Cannot publish without a message/); + }, /Cannot publish without a message\./); }); it('should throw if a message has no data', function() { assert.throws(function() { topic.publish({}); - }, /Cannot publish message without a `data` property/); + }, /Cannot publish message without a `data` property\./); }); it('should send correct api request', function(done) { diff --git a/packages/resource/test/index.js b/packages/resource/test/index.js index d7934a39ae1..d0ac5dc8631 100644 --- a/packages/resource/test/index.js +++ b/packages/resource/test/index.js @@ -327,7 +327,7 @@ describe('Resource', function() { assert.throws(function() { resourceWithoutProjectId.project(); - }, /A project ID is required/); + }, /A project ID is required\./); }); }); }); diff --git a/packages/storage/test/bucket.js b/packages/storage/test/bucket.js index c29baa8bcc6..249100b50bc 100644 --- a/packages/storage/test/bucket.js +++ b/packages/storage/test/bucket.js @@ -194,23 +194,19 @@ describe('Bucket', function() { describe('combine', function() { it('should throw if invalid sources are not provided', function() { - var error = 'You must provide at least two source files.'; - assert.throws(function() { bucket.combine(); - }, new RegExp(error)); + }, /You must provide at least two source files\./); assert.throws(function() { bucket.combine(['1']); - }, new RegExp(error)); + }, /You must provide at least two source files\./); }); it('should throw if a destination is not provided', function() { - var error = 'A destination file must be specified.'; - assert.throws(function() { bucket.combine(['1', '2']); - }, new RegExp(error)); + }, /A destination file must be specified\./); }); it('should accept string or file input for sources', function(done) { @@ -292,7 +288,7 @@ describe('Bucket', function() { it('should throw if content type cannot be determined', function() { assert.throws(function() { bucket.combine(['1', '2'], 'destination'); - }, /A content type could not be detected/); + }, /A content type could not be detected for the destination file\./); }); it('should make correct API request', function(done) { @@ -395,13 +391,13 @@ describe('Bucket', function() { it('should throw if an ID is not provided', function() { assert.throws(function() { bucket.createChannel(); - }, 'An ID is required to create a channel.'); + }, /An ID is required to create a channel\./); }); it('should throw if an address is not provided', function() { assert.throws(function() { bucket.createChannel(ID, {}); - }, 'An address is required to create a channel.'); + }, /An address is required to create a channel\./); }); it('should make the correct request', function(done) { @@ -607,7 +603,7 @@ describe('Bucket', function() { it('should throw if no name is provided', function() { assert.throws(function() { bucket.file(); - }, /A file name must be specified/); + }, /A file name must be specified\./); }); it('should return a File object', function() { diff --git a/packages/storage/test/file.js b/packages/storage/test/file.js index 6b7c9c59d19..a60480d255d 100644 --- a/packages/storage/test/file.js +++ b/packages/storage/test/file.js @@ -235,7 +235,7 @@ describe('File', function() { it('should throw if no destination is provided', function() { assert.throws(function() { file.copy(); - }, /should have a name/); + }, /Destination file should have a name\./); }); it('should URI encode file names', function(done) { @@ -335,7 +335,7 @@ describe('File', function() { it('should throw if a destination cannot be parsed', function() { assert.throws(function() { file.copy(function() {}); - }, /should have a name/); + }, /Destination file should have a name\./); }); }); @@ -479,21 +479,21 @@ describe('File', function() { start: 3, end: 8 }); - }, /Cannot use validation with file ranges/); + }, /Cannot use validation with file ranges \(start\/end\)\./); assert.throws(function() { file.createReadStream({ validation: true, start: 3 }); - }, /Cannot use validation with file ranges/); + }, /Cannot use validation with file ranges \(start\/end\)\./); assert.throws(function() { file.createReadStream({ validation: true, end: 8 }); - }, /Cannot use validation with file ranges/); + }, /Cannot use validation with file ranges \(start\/end\)\./); assert.doesNotThrow(function() { file.createReadStream({ @@ -1600,7 +1600,7 @@ describe('File', function() { file.getSignedPolicy({ expires: expires }, function() {}); - }, /cannot be in the past/); + }, /An expiration date cannot be in the past\./); }); }); @@ -1635,7 +1635,7 @@ describe('File', function() { expires: Date.now() + 5, equals: [{}] }, function() {}); - }, /Equals condition must be an array/); + }, /Equals condition must be an array of 2 elements\./); }); it('should throw if equal condition length is not 2', function() { @@ -1644,7 +1644,7 @@ describe('File', function() { expires: Date.now() + 5, equals: [['1', '2', '3']] }, function() {}); - }, /Equals condition must be an array of 2 elements/); + }, /Equals condition must be an array of 2 elements\./); }); }); @@ -1679,7 +1679,7 @@ describe('File', function() { expires: Date.now() + 5, startsWith: [{}] }, function() {}); - }, /StartsWith condition must be an array/); + }, /StartsWith condition must be an array of 2 elements\./); }); it('should throw if prefix condition length is not 2', function() { @@ -1688,7 +1688,7 @@ describe('File', function() { expires: Date.now() + 5, startsWith: [['1', '2', '3']] }, function() {}); - }, /StartsWith condition must be an array of 2 elements/); + }, /StartsWith condition must be an array of 2 elements\./); }); }); @@ -1711,7 +1711,7 @@ describe('File', function() { expires: Date.now() + 5, contentLengthRange: [{max: 1}] }, function() {}); - }, /ContentLengthRange must have numeric min & max fields/); + }, /ContentLengthRange must have numeric min & max fields\./); }); it('should throw if content length has no max', function() { @@ -1720,7 +1720,7 @@ describe('File', function() { expires: Date.now() + 5, contentLengthRange: [{min: 0}] }, function() {}); - }, /ContentLengthRange must have numeric min & max fields/); + }, /ContentLengthRange must have numeric min & max fields\./); }); }); }); @@ -1962,7 +1962,7 @@ describe('File', function() { action: 'read', expires: expires }, function() {}); - }, /cannot be in the past/); + }, /An expiration date cannot be in the past\./); }); }); @@ -2077,12 +2077,6 @@ describe('File', function() { }); describe('move', function() { - it('should throw if no destination is provided', function() { - assert.throws(function() { - file.move(); - }, /should have a name/); - }); - describe('copy to destination', function() { function assertCopyFile(file, expectedDestination, callback) { file.copy = function(destination) { diff --git a/packages/storage/test/index.js b/packages/storage/test/index.js index 9053da8b54d..b581c73c5ed 100644 --- a/packages/storage/test/index.js +++ b/packages/storage/test/index.js @@ -118,7 +118,7 @@ describe('Storage', function() { it('should throw if no name was provided', function() { assert.throws(function() { storage.bucket(); - }, /A bucket name is needed/); + }, /A bucket name is needed to use Google Cloud Storage\./); }); it('should accept a string for a name', function() { @@ -187,7 +187,7 @@ describe('Storage', function() { it('should throw if no name is provided', function() { assert.throws(function() { storage.createBucket(); - }, /A name is required/); + }, /A name is required to create a bucket\./); }); it('should execute callback with bucket', function(done) { diff --git a/packages/translate/test/index.js b/packages/translate/test/index.js index 89ed0abe370..00804e026e5 100644 --- a/packages/translate/test/index.js +++ b/packages/translate/test/index.js @@ -81,7 +81,7 @@ describe('Translate', function() { it('should throw if an API key is not provided', function() { assert.throws(function() { new Translate({}); - }, 'An API key is required to use the Translate API.'); + }, /An API key is required to use the Translate API\./); }); it('should localize the options', function() { @@ -266,7 +266,7 @@ describe('Translate', function() { it('should throw if `to` is not provided', function() { assert.throws(function() { translate.translate(INPUT, { from: SOURCE_LANG_CODE }, util.noop); - }, 'A target language is required to perform a translation.'); + }, /A target language is required to perform a translation\./); }); it('should make the correct API request', function(done) { diff --git a/packages/vision/test/index.js b/packages/vision/test/index.js index 83ec3b90175..60e83be02e8 100644 --- a/packages/vision/test/index.js +++ b/packages/vision/test/index.js @@ -262,7 +262,7 @@ describe('Vision', function() { assert.throws(function() { vision.detect(IMAGE, type, assert.ifError); - }, 'Requested detection feature not found: ' + type); + }, /Requested detection feature not found: not-real-type/); }); it('should format the correct config', function(done) {