Skip to content

🐛 Bug Report: You've forgotten to add unit tests to the repo #90

Closed

Description

@xni06

👟 Reproduction steps

Look for unit tests...

👍 Expected behavior

Expect to see some unit tests

👎 Actual Behavior

There aren't any unit tests :-(

🎲 Appwrite version

Version 2.0.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    bug
    on Sep 14, 2022
  2. lohanidamodar commented on Sep 21, 2022

    @lohanidamodar
    Member

    @xni06 Thank you for raising the issue. We do welcome the contribution if anyone is interested. However, the unit tests will have to be written in our https://github.com/appwrite/sdk-generator As our SDKs are generated from swagger specs, we need to generate relevant tests using the specs as well. We do plan on adding tests to all our SDKs.

  3. Shiba-Kar commented on Dec 2, 2022

    @Shiba-Kar
     static Future<Profile?> updateProfile(
        Account account,
        Databases databases,
        Profile profile,
      ) async {
        try {
          final user = await account.get();
          final doc = await databases.createDocument(
            databaseId: userDatabaseID,
            collectionId: profileCollectionID,
            documentId: user.$id,
            data: profile.toJson(),
            permissions: [Permission.read(Role.users())],
          );
    
          return Profile.fromJson(doc.data);
        } on AppwriteException catch (e) {
          Utils.debLog(e);
          return null;
        }
      }
    

    How can I test this peace of code in the test folder ?

  4. xni06 commented on Dec 2, 2022

    @xni06
    Author
     static Future<Profile?> updateProfile(
        Account account,
        Databases databases,
        Profile profile,
      ) async {
        try {
          final user = await account.get();
          final doc = await databases.createDocument(
            databaseId: userDatabaseID,
            collectionId: profileCollectionID,
            documentId: user.$id,
            data: profile.toJson(),
            permissions: [Permission.read(Role.users())],
          );
    
          return Profile.fromJson(doc.data);
        } on AppwriteException catch (e) {
          Utils.debLog(e);
          return null;
        }
      }

    How can I test this peace of code in the test folder ?

    Inject the dependencies; use https://pub.dev/packages/fake_cloud_firestore; verify/expect the outcome

  5. Shiba-Kar commented on Dec 3, 2022

    @Shiba-Kar

    @xni06 not working with firebase , I am working with Appwrite Databases

  6. xni06 commented on Dec 3, 2022

    @xni06
    Author

    @xni06 not working with firebase , I am working with Appwrite Databases

    It's the same principle - fake it

  7. lohanidamodar commented on Jun 22, 2023

    @lohanidamodar
    Member

    @xni06 We have now added unit tests with our SDK, we have about 73% test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions