-
Notifications
You must be signed in to change notification settings - Fork 1
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
PE-4923: Introduces methods for getting file name and extension #19
Conversation
return contentType.substring(contentType.lastIndexOf('/') + 1); | ||
} | ||
|
||
String getBasenameWithoutExtension({required String filePath}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matibat , can you add the withoutExtension
parameter and implement both options: with and without extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to introduce a new separate method when needed. 🙏
test/src/utils/path_utils_test.dart
Outdated
test('should return the file type from mimetype', () { | ||
final type = getFileTypeFromMime(contentType: 'application/pdf'); | ||
|
||
expect(type, 'pdf'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matibat please add more test cases here. Chat GPT can generate for you.
test/src/utils/path_utils_test.dart
Outdated
final basename = getBasenameWithoutExtension( | ||
filePath: '/hola/que/tal/file.pdf', | ||
); | ||
|
||
expect(basename, 'file'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before. Some test cases:
- filePath: 'file.pdf'
- filePath: 'file.pdf.txt'
- filePath: 'file' <- no extension on the file name (is it possible to get using IOFile?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need more test cases on the unit tests. This comment is optional: https://github.com/ar-io/ardrive_io/pull/19/files#r1385438373
Introduced more test cases, @thiagocarvalhodev . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.