Skip to content

Conversation

@rohansen856
Copy link
Contributor

Description

Please include a summary of the change and which issue is fixed. List any dependencies that are required for this change.

Fixes #388

Replace issue_no with the issue number which is fixed in this PR

Screenshots

Summary

  • A total of 46 new tests were added for 16files in the lib/app/models directory. All tests are observed to be passing.
  • Some files needed their own mock test file, which are auto generated through the command:
dart run build_runner build  
  • 2 test files were skipped: lib/app/models/storage/savefile.dart and lib/app/models/storage/set_config.dart as their code depend on platform specific configurations which is not possible for flutter unit tests. ex.:
Future<void> saveServerCert(String contents) async {
  if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    // ignore: deprecated_member_use
    var path = await getSavePath(
      suggestedName: 'server.cert.pem',
    );
    var data = Uint8List.fromList(contents.codeUnits);
    var file = XFile.fromData(
      data,
    );
    await file.saveTo(path!);
  } else {
    await FilePickerWritable().openFileForCreate(
      fileName: 'server.cert.pem',
      writer: (tempFile) => tempFile.writeAsString(contents),
    );
  }
}

the tests are passing on the command:

flutter test test/models --coverage

output:

00:05 +46: All tests passed!

Checklist

  • Tests have been added or updated to cover the changes
  • Documentation has been updated to reflect the changes
  • Code follows the established coding style guidelines
  • All tests are passing

@BrawlerXull
Copy link
Contributor

gg 🚀

@BrawlerXull BrawlerXull merged commit d1d4ca2 into CCExtractor:main Dec 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

tests: add unit tests for all files

2 participants