Skip to content

Commit 6b84a83

Browse files
author
Yong Bakos
committed
Rhizome: Add query method.
We need an initial way to 'just get everything,' so provide a basic implementation.
1 parent b0fa87f commit 6b84a83

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/src/rhizome.dart

+7
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ class Rhizome {
3030
_repertory.register(thing);
3131
return thing;
3232
}
33+
34+
/// WIP: Retrieve a list of [Thing]s meeting provided criteria.
35+
/// WIP: Right now, omit the criteria and just return everything.
36+
List<Thing> query() {
37+
return _continuum.things.values.toList();
38+
}
39+
3340
}

test/rhizome_test.dart

+12
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,17 @@ void main() {
5151
repertory: Repertory(index: {information: uri}));
5252
expect(rhizome.store(information), equals(thing));
5353
});
54+
55+
test('WIP: #query of an empty Rhizome returns an empty list', () {
56+
expect(rhizome.query().length, equals(0));
57+
});
58+
59+
test('WIP: #query returns a list of every Thing', () {
60+
final first = rhizome.store('Fake 1');
61+
final second = rhizome.store('Fake 2');
62+
expect(rhizome.query().length, equals(2));
63+
expect(rhizome.query().contains(first), isTrue);
64+
expect(rhizome.query().contains(second), isTrue);
65+
});
5466
});
5567
}

0 commit comments

Comments
 (0)