Skip to content

[RFC] [cross_file] New architecture. #7591

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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adapt new tests to latest API changes.
  • Loading branch information
ditman committed Oct 9, 2024
commit 14001c9a5c5ecaa2ef9934d4f61f0ca6fd957fd2
10 changes: 4 additions & 6 deletions packages/cross_file/test/x_file_html_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
late XFile file;

setUp(() async {
file = await XFileFactory.fromObjectUrl(textFileUrl);
file = XFileFactory.fromObjectUrl(textFileUrl);
});

test('Can be read as a string', () async {
Expand Down Expand Up @@ -84,18 +84,16 @@ void main() {

test('Data may be purged from the blob!', () async {
expect(() async {
final XFile fileBeforeRevoke =
await XFileFactory.fromObjectUrl(objectUrl);
final XFile fileBeforeRevoke = XFileFactory.fromObjectUrl(objectUrl);
await fileBeforeRevoke.readAsBytes();
}, returnsNormally);

html.URL.revokeObjectURL(objectUrl);

expect(() async {
final XFile fileAfterRevoke =
await XFileFactory.fromObjectUrl(objectUrl);
final XFile fileAfterRevoke = XFileFactory.fromObjectUrl(objectUrl);
await fileAfterRevoke.readAsBytes();
}, throwsStateError);
}, throwsException);
});
});

Expand Down
12 changes: 0 additions & 12 deletions packages/cross_file/test/x_file_io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ final File textFile = File(path);
final String textFilePath = textFile.path;

void main() {
group('Former constructors', () {
test('should throw', () {
expect(() {
XFile('potato');
}, throwsUnimplementedError);

expect(() {
XFile.fromData(Uint8List.fromList(<int>[]));
}, throwsUnimplementedError);
});
});

group('Create with a path', () {
test('Can be read as a string', () async {
final XFile file = XFileFactory.fromPath(textFilePath);
Expand Down