Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: test/db/db_test.dart

Issue 937133002: Add DatastoreDB.replace({defaultPartition}) (Closed) Base URL: git@github.com:dart-lang/gcloud.git@master
Patch Set: Addressed comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library gcloud.db_test;
6
7 import 'package:gcloud/db.dart';
8 import 'package:unittest/unittest.dart';
9
10 @Kind()
11 class Foobar extends Model {}
12
13 main() {
14 group('db', () {
15 test('default-partition', () {
16 var db = new DatastoreDB(null);
17
18 // Test defaultPartition
19 expect(db.defaultPartition.namespace, isNull);
20
21 // Test emptyKey
22 expect(db.emptyKey.partition.namespace, isNull);
23
24 // Test emptyKey.append()
25 var key = db.emptyKey.append(Foobar, id: 42);
26 expect(key.parent, db.emptyKey);
27 expect(key.partition.namespace, isNull);
28 expect(key.id, 42);
29 expect(key.type, equals(Foobar));
30 });
31
32 test('non-default-partition', () {
33 var nsDb = new DatastoreDB(
34 null, defaultPartition: new Partition('foobar-namespace'));
35
36 // Test defaultPartition
37 expect(nsDb.defaultPartition.namespace, 'foobar-namespace');
38
39 // Test emptyKey
40 expect(nsDb.emptyKey.partition.namespace, 'foobar-namespace');
41
42 // Test emptyKey.append()
43 var key = nsDb.emptyKey.append(Foobar, id: 42);
44 expect(key.parent, nsDb.emptyKey);
45 expect(key.partition.namespace, 'foobar-namespace');
46 expect(key.id, 42);
47 expect(key.type, equals(Foobar));
48 });
49 });
50 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698