Giter VIP home page Giter VIP logo

firebase_storage_mocks's People

Contributors

alxflam avatar atn832 avatar cedvdb avatar gabrielineichen avatar jarrodonlo avatar kalervohyyppa avatar samumazzi avatar saroad2 avatar supercaly avatar timcreatedit avatar wahdanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

firebase_storage_mocks's Issues

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

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

IDE not support import

The IDE doesn't seem to support importing the class.

However, when I run the tests it works.

Do you have an idea?

CleanShot 2022-10-07 at 10 25 55@2x

Versions incompatible

This package is incompatible with cloud_firestore_mocks because of this error:

Because no versions of cloud_firestore_mocks match >0.8.0 <0.9.0 and cloud_firestore_mocks 0.8.0 depends on mockito ^5.0.0, cloud_firestore_mocks ^0.8.0 requires mockito ^5.0.0.

And because every version of firebase_storage_mocks depends on mockito ^4.1.0, cloud_firestore_mocks ^0.8.0 is incompatible with firebase_storage_mocks.

If I override the dependency to mockito ^5.0.0, I get the next error:

Because firebase_storage_mocks >=0.2.0 depends on firebase_storage ^4.0.0 and my_app depends on firebase_storage ^8.0.0, firebase_storage_mocks >=0.2.0 is forbidden.

So it also seems to be incompatible with the current version of firebase_storage


I think just bumping both versions should do the trick, unless there were some breaking changes.

Web support?

Do you mind if I ask why no web support, since firebase_storage package has web support?

I know this mock package wouldn't support putFile(File file) or writeToFile(File file), but neither does the the original firebase_storage which it implements, so that seems consistent.

Typo: Usage example errors

The current Usage example in README.md instantiates MockFirebaseStorage('someimage.png');; however, MockFirebaseStorage has zero parameters (though in example here it is given 'someimage.png'.)

I plan on creating a PR that fixes this and a few other items in usage example.

No implementation of MockStorageReference.getDownloadURL

I've gone ahead and forked this repo and implemented getDownloadURL within MockStorageReference. It seems that there is no way, AFAIK, to construct a download url that is similar to an actual Firebase Storage download URL (https://firebasestorage.googleapis.com/v0/b/{your-application}.appspot.com/o/{url-encoded-path-name}?alt=media&token={your-token}) so I have it returning a dummy value instead (https://firebasestorage.googleapis.com/{path}). This dummy value could be updated so that _path is url encoded when interpolated into the download URL path that the function returns. Also, there could probably also be a test written around this, but I didn't see any Mock Reference tests.

Let me know if you are interested in me creating a PR for my fork.

The getter 'onComplete' was called on null

When I run the example code, the putFile method always returns null. I also tried using the putData method instead but it results in the same error which is:

NoSuchMethodError: The getter 'onComplete' was called on null.
Receiver: null
Tried calling: onComplete

Any help will be appreciated.
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.