Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use strictEqual in tests #186

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/system-test/subscriptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test.serial(`should create a subscription`, async t => {
const [subscriptions] = await pubsub
.topic(topicNameOne)
.getSubscriptions();
assert.equal(subscriptions[0].name, fullSubscriptionNameOne);
assert.strictEqual(subscriptions[0].name, fullSubscriptionNameOne);
})
.start();
});
Expand Down Expand Up @@ -191,7 +191,7 @@ test.serial(`should listen for ordered messages`, async t => {
subscriptionNameThree,
timeout
);
assert.equal(console.log.callCount, 3);
assert.strictEqual(console.log.callCount, 3);
assert.deepEqual(console.log.secondCall.args, [
`* %d %j %j`,
publishedMessageIds[2],
Expand Down
8 changes: 4 additions & 4 deletions system-test/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('pubsub', function() {
});

// get all topics in list of known names
assert.equal(results.length, TOPIC_NAMES.length);
assert.strictEqual(results.length, TOPIC_NAMES.length);
done();
});
});
Expand All @@ -149,7 +149,7 @@ describe('pubsub', function() {
return TOPIC_FULL_NAMES.indexOf(name) !== -1;
});

assert.equal(results.length, TOPIC_NAMES.length);
assert.strictEqual(results.length, TOPIC_NAMES.length);
done();
});
});
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('pubsub', function() {
it('should list all subscriptions registered to the topic', function(done) {
topic.getSubscriptions(function(err, subs) {
assert.ifError(err);
assert.equal(subs.length, SUBSCRIPTIONS.length);
assert.strictEqual(subs.length, SUBSCRIPTIONS.length);
assert(subs[0] instanceof Subscription);
done();
});
Expand All @@ -319,7 +319,7 @@ describe('pubsub', function() {
subscriptionsEmitted.push(subscription);
})
.on('end', function() {
assert.equal(subscriptionsEmitted.length, SUBSCRIPTIONS.length);
assert.strictEqual(subscriptionsEmitted.length, SUBSCRIPTIONS.length);
done();
});
});
Expand Down
56 changes: 28 additions & 28 deletions test/gapic-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('PublisherClient', () => {

client.createTopic(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('PublisherClient', () => {

client.updateTopic(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('PublisherClient', () => {

client.publish(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -274,7 +274,7 @@ describe('PublisherClient', () => {

client.getTopic(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('PublisherClient', () => {

client.listTopics(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('PublisherClient', () => {

client.listTopicSubscriptions(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -454,7 +454,7 @@ describe('PublisherClient', () => {

client.deleteTopic(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('PublisherClient', () => {

client.setIamPolicy(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -581,7 +581,7 @@ describe('PublisherClient', () => {

client.getIamPolicy(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -642,7 +642,7 @@ describe('PublisherClient', () => {

client.testIamPermissions(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -719,7 +719,7 @@ describe('SubscriberClient', () => {

client.createSubscription(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -791,7 +791,7 @@ describe('SubscriberClient', () => {

client.getSubscription(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -875,7 +875,7 @@ describe('SubscriberClient', () => {

client.updateSubscription(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -942,7 +942,7 @@ describe('SubscriberClient', () => {

client.listSubscriptions(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -998,7 +998,7 @@ describe('SubscriberClient', () => {

client.deleteSubscription(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -1061,7 +1061,7 @@ describe('SubscriberClient', () => {

client.modifyAckDeadline(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -1120,7 +1120,7 @@ describe('SubscriberClient', () => {

client.acknowledge(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -1182,7 +1182,7 @@ describe('SubscriberClient', () => {

client.pull(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1264,7 +1264,7 @@ describe('SubscriberClient', () => {
})
.on('error', err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});

Expand Down Expand Up @@ -1325,7 +1325,7 @@ describe('SubscriberClient', () => {

client.modifyPushConfig(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -1391,7 +1391,7 @@ describe('SubscriberClient', () => {

client.listSnapshots(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1463,7 +1463,7 @@ describe('SubscriberClient', () => {

client.createSnapshot(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1549,7 +1549,7 @@ describe('SubscriberClient', () => {

client.updateSnapshot(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1599,7 +1599,7 @@ describe('SubscriberClient', () => {

client.deleteSnapshot(request, err => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
done();
});
});
Expand Down Expand Up @@ -1657,7 +1657,7 @@ describe('SubscriberClient', () => {

client.seek(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1729,7 +1729,7 @@ describe('SubscriberClient', () => {

client.setIamPolicy(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1797,7 +1797,7 @@ describe('SubscriberClient', () => {

client.getIamPolicy(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down Expand Up @@ -1864,7 +1864,7 @@ describe('SubscriberClient', () => {

client.testIamPermissions(request, (err, response) => {
assert(err instanceof Error);
assert.equal(err.code, FAKE_STATUS_CODE);
assert.strictEqual(err.code, FAKE_STATUS_CODE);
assert(typeof response === 'undefined');
done();
});
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var fakePaginator = {
}

methods = arrify(methods);
assert.equal(Class.name, 'PubSub');
assert.strictEqual(Class.name, 'PubSub');
assert.deepEqual(methods, [
'getSnapshots',
'getSubscriptions',
Expand Down Expand Up @@ -1300,7 +1300,7 @@ describe('PubSub', function() {

it('should pass specified name to the Subscription', function(done) {
SubscriptionOverride = function(pubsub, name) {
assert.equal(name, SUB_NAME);
assert.strictEqual(name, SUB_NAME);
done();
};
pubsub.subscription(SUB_NAME);
Expand Down
4 changes: 2 additions & 2 deletions test/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ describe('Subscription', function() {
describe('formatName_', function() {
it('should format name', function() {
var formattedName = Subscription.formatName_(PROJECT_ID, SUB_NAME);
assert.equal(formattedName, SUB_FULL_NAME);
assert.strictEqual(formattedName, SUB_FULL_NAME);
});

it('should format name when given a complete name', function() {
var formattedName = Subscription.formatName_(PROJECT_ID, SUB_FULL_NAME);
assert.equal(formattedName, SUB_FULL_NAME);
assert.strictEqual(formattedName, SUB_FULL_NAME);
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ describe('Topic', function() {
describe('formatName_', function() {
it('should format name', function() {
var formattedName = Topic.formatName_(PROJECT_ID, TOPIC_UNFORMATTED_NAME);
assert.equal(formattedName, TOPIC_NAME);
assert.strictEqual(formattedName, TOPIC_NAME);
});

it('should format name when given a complete name', function() {
var formattedName = Topic.formatName_(PROJECT_ID, TOPIC_NAME);
assert.equal(formattedName, TOPIC_NAME);
assert.strictEqual(formattedName, TOPIC_NAME);
});
});

Expand Down Expand Up @@ -523,7 +523,7 @@ describe('Topic', function() {
var opts = {};

topic.parent.subscription = function(name, options) {
assert.equal(name, subscriptionName);
assert.strictEqual(name, subscriptionName);
assert.deepEqual(options, opts);
done();
};
Expand Down