Skip to content

Commit

Permalink
Fix AlgoliaMultiIndexesReference const val issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathiwala committed Oct 25, 2021
1 parent df745d0 commit ffa24dc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/src/index_reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ class AlgoliaIndexReference extends AlgoliaQuery {
}

class AlgoliaMultiIndexesReference {
const AlgoliaMultiIndexesReference._(Algolia algolia,
{List<AlgoliaQuery>? queries})
AlgoliaMultiIndexesReference._(Algolia algolia, {List<AlgoliaQuery>? queries})
: _algolia = algolia,
_queries = queries ?? const [];
_queries = queries ?? [];

final List<AlgoliaQuery>? _queries;
final Algolia _algolia;
Expand Down
33 changes: 33 additions & 0 deletions test/algolia_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,39 @@ void main() async {
});

group('querying', () {
test('Perform Batch', () async {
var batch = algolia.instance.index('contacts').batch();
batch.clearIndex();
// batchB.clearIndex();
for (var i = 0; i < 10; i++) {
var addData = <String, dynamic>{
'name': 'John ${DateTime.now().microsecond}',
'contact': '+1 ${DateTime.now().microsecondsSinceEpoch}',
'email': 'johan.${DateTime.now().microsecond}@example.com',
'isDelete': false,
'status': 'published',
'createdAt': DateTime.now(),
'modifiedAt': DateTime.now(),
'price': i + 200,
};

batch.addObject(addData);
}

// Get Result/Objects
taskBatch = await batch.commit();
await taskBatch.waitTask();

// Checking if has [AlgoliaTask]
expect(taskBatch.runtimeType, AlgoliaTask);
print(taskBatch.data);
print('\n\n');

// Add ids to list for test 8
final List batchIds = taskBatch.data['objectIDs'];
ids.addAll([batchIds[3], batchIds[4]]);
});

test('Perform Query', () async {
var query = algolia.instance.index('contacts').query('john');

Expand Down

0 comments on commit ffa24dc

Please sign in to comment.