Skip to content

Commit a7baacd

Browse files
JustinBeckwiththiyaguk09
authored andcommitted
fix(deps): remove dependency on string-format-obj (googleapis#231)
1 parent f88ff8e commit a7baacd

4 files changed

Lines changed: 9 additions & 39 deletions

File tree

handwritten/bigtable/test/app-profile.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
var assert = require('assert');
2020
var extend = require('extend');
21-
var format = require('string-format-obj');
2221
var proxyquire = require('proxyquire');
23-
2422
const common = require('@google-cloud/common-grpc');
2523

2624
var promisified = false;
@@ -41,11 +39,7 @@ describe('Bigtable/AppProfile', function() {
4139
bigtable: {projectId: PROJECT_ID},
4240
};
4341

44-
var APP_PROFILE_NAME = format('{instance}/appProfiles/{appProfile}', {
45-
instance: INSTANCE.name,
46-
appProfile: APP_PROFILE_ID,
47-
});
48-
42+
var APP_PROFILE_NAME = `${INSTANCE.name}/appProfiles/${APP_PROFILE_ID}`;
4943
var AppProfile;
5044
var appProfile;
5145

handwritten/bigtable/test/cluster.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
var assert = require('assert');
2020
var extend = require('extend');
21-
var format = require('string-format-obj');
2221
var proxyquire = require('proxyquire');
2322

2423
const common = require('@google-cloud/common-grpc');
@@ -41,11 +40,7 @@ describe('Bigtable/Cluster', function() {
4140
bigtable: {projectId: PROJECT_ID},
4241
};
4342

44-
var CLUSTER_NAME = format('{instance}/clusters/{cluster}', {
45-
instance: INSTANCE.name,
46-
cluster: CLUSTER_ID,
47-
});
48-
43+
var CLUSTER_NAME = `${INSTANCE.name}/clusters/${CLUSTER_ID}`;
4944
var Cluster;
5045
var cluster;
5146

@@ -105,31 +100,22 @@ describe('Bigtable/Cluster', function() {
105100
var LOCATION = 'us-centralb-1';
106101

107102
it('should format the location name', function() {
108-
var expected = format('projects/{project}/locations/{location}', {
109-
project: PROJECT_ID,
110-
location: LOCATION,
111-
});
112-
103+
var expected = `projects/${PROJECT_ID}/locations/${LOCATION}`;
113104
var formatted = Cluster.getLocation_(PROJECT_ID, LOCATION);
114105
assert.strictEqual(formatted, expected);
115106
});
116107

117108
it('should format the location name for project name with /', function() {
118109
var PROJECT_NAME = 'projects/grape-spaceship-123';
119-
var expected = format('projects/{project}/locations/{location}', {
120-
project: PROJECT_NAME.split('/').pop(),
121-
location: LOCATION,
122-
});
123-
110+
var expected = `projects/${PROJECT_NAME.split(
111+
'/'
112+
).pop()}/locations/${LOCATION}`;
124113
var formatted = Cluster.getLocation_(PROJECT_NAME, LOCATION);
125114
assert.strictEqual(formatted, expected);
126115
});
127116

128117
it('should not re-format a complete location', function() {
129-
var complete = format('projects/p/locations/{location}', {
130-
location: LOCATION,
131-
});
132-
118+
var complete = `projects/p/locations/${LOCATION}`;
133119
var formatted = Cluster.getLocation_(PROJECT_ID, complete);
134120
assert.strictEqual(formatted, complete);
135121
});

handwritten/bigtable/test/family.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
var assert = require('assert');
2020
var extend = require('extend');
21-
var format = require('string-format-obj');
2221
var proxyquire = require('proxyquire');
2322
const {util} = require('@google-cloud/common-grpc');
2423

@@ -41,11 +40,7 @@ describe('Bigtable/Family', function() {
4140
createFamily: util.noop,
4241
};
4342

44-
var FAMILY_NAME = format('{t}/columnFamilies/{f}', {
45-
t: TABLE.name,
46-
f: FAMILY_ID,
47-
});
48-
43+
var FAMILY_NAME = `${TABLE.name}/columnFamilies/${FAMILY_ID}`;
4944
var Family;
5045
var family;
5146
var FamilyError;

handwritten/bigtable/test/instance.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
var assert = require('assert');
2020
const common = require('@google-cloud/common-grpc');
2121
var extend = require('extend');
22-
var format = require('string-format-obj');
2322
var proxyquire = require('proxyquire');
2423

2524
var AppProfile = require('../src/app-profile.js');
@@ -66,11 +65,7 @@ describe('Bigtable/Instance', function() {
6665
var INSTANCE_ID = 'my-instance';
6766
var BIGTABLE = {projectName: 'projects/my-project'};
6867

69-
var INSTANCE_NAME = format('{project}/instances/{instance}', {
70-
project: BIGTABLE.projectName,
71-
instance: INSTANCE_ID,
72-
});
73-
68+
var INSTANCE_NAME = `${BIGTABLE.projectName}/instances/${INSTANCE_ID}`;
7469
var APP_PROFILE_ID = 'my-app-profile';
7570
var CLUSTER_ID = 'my-cluster';
7671

0 commit comments

Comments
 (0)