Skip to content

Commit

Permalink
Merge pull request #33 from GoogleCloudPlatform/datastore-v1beta3
Browse files Browse the repository at this point in the history
Added back datastore v1beta3 samples.
  • Loading branch information
jmdobry committed Feb 25, 2016
2 parents 5b9734e + 5216d71 commit daa12aa
Show file tree
Hide file tree
Showing 9 changed files with 1,859 additions and 1 deletion.
1,316 changes: 1,316 additions & 0 deletions datastore/concepts.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
},
"dependencies": {
"async": "^1.5.2",
"gcloud": "^0.27.0"
"gcloud": "^0.28.0"
}
}
123 changes: 123 additions & 0 deletions test/datastore/entity.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Copyright 2015, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

var testUtil = require('./util.js');

var Entity = require('../../datastore/concepts').Entity;
var entity;

describe('datastore/concepts/entity', function () {
before(function() {
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
entity = new Entity(projectId);
});

after(function(done) {
var datastore = entity.datastore;
var query = datastore.createQuery('Task');

testUtil.deleteEntities(datastore, query, done);
});

describe('incomplete key', function() {
it('saves with an incomplete key', function(done) {
entity.testIncompleteKey(done);
});
});

describe('testNamedKey', function() {
it('saves with a named key', function(done) {
entity.testNamedKey(done);
});
});

describe('testKeyWithParent', function() {
it('saves a key with a parent', function(done) {
entity.testKeyWithParent(done);
});
});

describe('testKeyWithMultiLevelParent', function() {
it('saves a key with multiple parents', function(done) {
entity.testKeyWithMultiLevelParent(done);
});
});

describe('testEntityWithParent', function() {
it('saves an entity with a parent', function(done) {
entity.testEntityWithParent(done);
});
});

describe('testProperties', function() {
it('saves an entity with properties', function(done) {
entity.testProperties(done);
});
});

describe('testArrayValue', function() {
it('saves an entity with arrays', function(done) {
entity.testArrayValue(done);
});
});

describe('testBasicEntity', function() {
it('saves a basic entity', function(done) {
entity.testBasicEntity(done);
});
});

describe('testInsert', function() {
it('saves with an insert', function(done) {
entity.testInsert(done);
});
});

describe('testLookup', function() {
it('performs a lookup', function(done) {
entity.testLookup(done);
});
});

describe('testUpdate', function() {
it('saves with an update', function(done) {
entity.testUpdate(done);
});
});

describe('testDelete', function() {
it('deletes an entity', function(done) {
entity.testDelete(done);
});
});

describe('testBatchUpsert', function() {
it('performs a batch upsert', function(done) {
entity.testBatchUpsert(done);
});
});

describe('testBatchLookup', function() {
it('performs a batch lookup', function(done) {
entity.testBatchLookup(done);
});
});

describe('testBatchDelete', function() {
it('performs a batch delete', function(done) {
entity.testBatchDelete(done);
});
});
});
37 changes: 37 additions & 0 deletions test/datastore/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
indexes:
- kind: Task
properties:
- name: done
- name: priority
direction: desc
- kind: Task
properties:
- name: priority
- name: percent_complete
- kind: Task
properties:
- name: type
- name: priority
- kind: Task
properties:
- name: priority
- name: created
- kind: Task
properties:
- name: done
- name: created
- kind: Task
properties:
- name: type
- name: priority
direction: desc
- kind: Task
properties:
- name: type
- name: created
- kind: Task
properties:
- name: priority
direction: desc
- name: created

47 changes: 47 additions & 0 deletions test/datastore/indexes.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2015, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

var testUtil = require('./util.js');

var Index = require('../../datastore/concepts').Index;
var index;

describe('datastore/concepts/indexes', function () {
before(function() {
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
index = new Index(projectId);
});

after(function(done) {
var datastore = index.datastore;
var query = datastore.createQuery('Task');

testUtil.deleteEntities(datastore, query, done);
});

describe('unindexed properties', function() {
it('performs a query with a filter on an unindexed property',
function(done) {
index.testUnindexedPropertyQuery(done);
}
);
});

describe('exploding properties', function() {
it('inserts arrays of data', function(done) {
index.testExplodingProperties(done);
});
});
});
57 changes: 57 additions & 0 deletions test/datastore/metadata.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2015, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

var testUtil = require('./util.js');

var Metadata = require('../../datastore/concepts').Metadata;
var metadata;

describe('datastore/concepts/metadata', function () {
before(function() {
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
metadata = new Metadata(projectId);
});

after(function(done) {
var datastore = metadata.datastore;
var query = datastore.createQuery('Task');

testUtil.deleteEntities(datastore, query, done);
});

describe('namespace query', function() {
it('performs a namespace query', function(done) {
metadata.testNamespaceRunQuery(done);
});
});

describe('kinds query', function() {
it('performs a kind query', function(done) {
metadata.testKindRunQuery(done);
});
});

describe('property query', function() {
it('performs a property query', function(done) {
metadata.testPropertyRunQuery(done);
});
});

describe('property by kind query', function() {
it('performs a property by kind query', function(done) {
metadata.testPropertyByKindRunQuery(done);
});
});
});
Loading

0 comments on commit daa12aa

Please sign in to comment.