Chromium Code Reviews| OLD | NEW |
|---|---|
| (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('replace-default-partition', () { | |
| 33 var db = new DatastoreDB(null); | |
|
Søren Gjesse
2015/02/19 11:59:51
Maybe duplicate this test with:
var nsDb = new Da
kustermann
2015/02/19 12:17:11
No need to duplicate it now, since I've removed th
| |
| 34 var nsDb = db.replace( | |
| 35 defaultPartition: new Partition('foobar-namespace')); | |
| 36 | |
| 37 // Test defaultPartition | |
| 38 expect(nsDb.defaultPartition.namespace, 'foobar-namespace'); | |
| 39 | |
| 40 // Test emptyKey | |
| 41 expect(nsDb.emptyKey.partition.namespace, 'foobar-namespace'); | |
| 42 | |
| 43 // Test emptyKey.append() | |
| 44 var key = nsDb.emptyKey.append(Foobar, id: 42); | |
| 45 expect(key.parent, nsDb.emptyKey); | |
| 46 expect(key.partition.namespace, 'foobar-namespace'); | |
| 47 expect(key.id, 42); | |
| 48 expect(key.type, equals(Foobar)); | |
| 49 }); | |
| 50 }); | |
| 51 } | |
| OLD | NEW |