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

core: test missing library exports #1039

Merged
merged 1 commit into from
Dec 29, 2015
Merged
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
45 changes: 45 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ function createFakeApi() {
}

var FakeBigQuery = createFakeApi();
var FakeCompute = createFakeApi();
var FakeDatastore = createFakeApi();
var FakeDNS = createFakeApi();
var FakePrediction = createFakeApi();
var FakePubSub = createFakeApi();
var FakeResource = createFakeApi();
var FakeSearch = createFakeApi();
var FakeStorage = createFakeApi();

Expand All @@ -44,9 +47,12 @@ describe('gcloud', function() {

before(function() {
mockery.registerMock('./bigquery', FakeBigQuery);
mockery.registerMock('./compute', FakeCompute);
mockery.registerMock('./datastore', FakeDatastore);
mockery.registerMock('./dns', FakeDNS);
mockery.registerMock('./prediction', FakePrediction);
mockery.registerMock('./pubsub', FakePubSub);
mockery.registerMock('./resource', FakeResource);
mockery.registerMock('./search', FakeSearch);
mockery.registerMock('./storage', FakeStorage);
mockery.enable({
Expand All @@ -69,6 +75,10 @@ describe('gcloud', function() {
assert.strictEqual(gcloud.bigquery, FakeBigQuery);
});

it('should export static compute', function() {
assert.strictEqual(gcloud.compute, FakeCompute);
});

it('should export static datastore', function() {
assert.strictEqual(gcloud.datastore, FakeDatastore);
});
Expand All @@ -77,10 +87,18 @@ describe('gcloud', function() {
assert.strictEqual(gcloud.dns, FakeDNS);
});

it('should export static prediction', function() {
assert.strictEqual(gcloud.prediction, FakePrediction);
});

it('should export static pubsub', function() {
assert.strictEqual(gcloud.pubsub, FakePubSub);
});

it('should export static resource', function() {
assert.strictEqual(gcloud.resource, FakeResource);
});

it('should export static search', function() {
assert.strictEqual(gcloud.search, FakeSearch);
});
Expand Down Expand Up @@ -129,6 +147,15 @@ describe('gcloud', function() {
});
});

describe('compute', function() {
it('should create a new Compute', function() {
var compute = localGcloud.compute(options);

assert(compute instanceof FakeCompute);
assert.strictEqual(compute.calledWith_[0], options);
});
});

describe('datastore', function() {
it('should create a single Datastore', function() {
var datastore = localGcloud.datastore;
Expand All @@ -147,6 +174,15 @@ describe('gcloud', function() {
});
});

describe('prediction', function() {
it('should create a new Prediction', function() {
var prediction = localGcloud.prediction(options);

assert(prediction instanceof FakePrediction);
assert.strictEqual(prediction.calledWith_[0], options);
});
});

describe('pubsub', function() {
it('should create a new PubSub', function() {
var pubsub = localGcloud.pubsub(options);
Expand All @@ -156,6 +192,15 @@ describe('gcloud', function() {
});
});

describe('resource', function() {
it('should create a new Prediction', function() {
var resource = localGcloud.resource(options);

assert(resource instanceof FakeResource);
assert.strictEqual(resource.calledWith_[0], options);
});
});

describe('search', function() {
it('should create a new Search', function() {
var search = localGcloud.search(options);
Expand Down