diff --git a/test/models/test_client.dart b/test/models/test_client.dart index 7f8d068..5f7a036 100644 --- a/test/models/test_client.dart +++ b/test/models/test_client.dart @@ -108,14 +108,10 @@ class TestMeiliSearchClient extends MeiliSearchClient { } Future disposeUsedResources() async { - final indexesCopy = usedIndexes.toList(); await Future.wait([ _deleteUsedIndexes(), _deleteUsedKeys(), ]); - if (indexesCopy.isNotEmpty) { - await _deleteTasksForDeletedIndexes(indexesCopy); - } } Future _deleteUsedIndexes() async { @@ -131,8 +127,4 @@ class TestMeiliSearchClient extends MeiliSearchClient { ), ); } - - Future _deleteTasksForDeletedIndexes(List indexes) async { - await deleteTasks(params: DeleteTasksQuery(indexUids: indexes)); - } } diff --git a/test/swaps_test.dart b/test/swaps_test.dart index 58ba326..6ffb2ee 100644 --- a/test/swaps_test.dart +++ b/test/swaps_test.dart @@ -9,10 +9,15 @@ void main() { setUpClient(); test('swaps indexes from input', () async { - var books = ['books', 'books_new']; - var movies = ['movies', 'movies_new']; + var books = [randomUid('books'), randomUid('books_new')]; + var movies = [randomUid('movies'), randomUid('movies_new')]; var swaps = [SwapIndex(books), SwapIndex(movies)]; + // first create the indexes to be swapped + for (var index in books + movies) { + await client.createIndex(index).waitFor(client: client); + } + var response = await client .swapIndexes( swaps, @@ -20,10 +25,12 @@ void main() { ) .waitFor( client: client, - throwFailed: false, + throwFailed: true, ); expect(response.type, 'indexSwap'); + expect(response.error, null); + expect(response.status, 'succeeded'); expect(response.details!['swaps'], [ {'indexes': books}, {'indexes': movies}