atn832 / firebase_storage_mocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class 'MockReference' has no instance method 'listAll' with matching arguments.

fayez-nazzal opened this issue · comments

This package mocks many needed FirebaseStorage functions out of the box, though I find it lacks list and listAll implementation.

Executing this test:

    test('uploaded file to cloud can be listed', () async {
      final instance = MockFirebaseStorage();

      var path = 'test/test/test/test';

      final File testFile = await File('test/fixtures/test.jpg');

      final Reference ref = instance.ref().child(path);

      await ref.putFile(testFile);

      final files = await ref.listAll();

      expect(files.items.length == 1, true);
    });

Gives the following error:

  NoSuchMethodError: Class 'MockReference' has no instance method 'listAll' with matching arguments.
  Receiver: Instance of 'MockReference'
  Tried calling: listAll()
  Found: listAll() => Future<ListResult>
  dart:core                                                              Object.noSuchMethod
  package:firebase_storage_mocks/src/mock_storage_reference.dart 123:56  MockReference.noSuchMethod
  package:firebase_storage/src/reference.dart 91:22                      MockReference.listAll

Fixed by #33.