Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mockable plugin instances & methods #4563

Closed
Ehesp opened this issue Jan 4, 2021 · 1 comment
Closed

Mockable plugin instances & methods #4563

Ehesp opened this issue Jan 4, 2021 · 1 comment
Assignees
Labels
plugin: core type: bug Something isn't working

Comments

@Ehesp
Copy link
Member

Ehesp commented Jan 4, 2021

Bug report

Currently to access the reworked plugins, you access them via statics, e.g:

FirebaseFirestore.instance

Since they're statics, they are not mockable.

Solutions

One solution proposed by @rrousselGit is to expose a mock static method for each plugin, e.g:

void main() {
  final mock = FirebaseFirestore.mock();

  afterEach(mock.reset);

  test('foo', () {
    mock.mockDocument('key', {'foo': 42});
  });
}
@Ehesp Ehesp added type: bug Something isn't working Needs Attention This issue needs maintainer attention. labels Jan 4, 2021
@rrousselGit rrousselGit self-assigned this Jan 4, 2021
@TahaTesser TahaTesser added plugin: core and removed Needs Attention This issue needs maintainer attention. labels Jan 5, 2021
@TahaTesser
Copy link

Just adding the core label to get this issue out of backlog since this is for all packages, not sure we need to add all the package labels

@firebase firebase locked and limited conversation to collaborators Jul 9, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
plugin: core type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants