Files
cutdex/packages/cutdex_native/test/drop_configuration_test.dart
lingjhf 27e77fff39 feat: initial Cutdex application
Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
2026-10-05 23:36:23 +08:00

42 lines
1.2 KiB
Dart

import 'package:cutdex_native/cutdex_native.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('invalid policies fail before reaching native registration', () {
expect(
() => NativeDropConfiguration(maximumFileCount: 0),
throwsArgumentError,
);
expect(
() => NativeDropConfiguration(allowedExtensions: ['']),
throwsArgumentError,
);
});
test('configuration owns an immutable extension whitelist', () {
final extensions = ['wav'];
final configuration = NativeDropConfiguration(
allowedExtensions: extensions,
);
extensions[0] = 'mp4';
expect(configuration.accepts(['/sample.wav']), true);
expect(configuration.accepts(['/sample.mp4']), false);
expect(
() => configuration.allowedExtensions!.add('mp4'),
throwsUnsupportedError,
);
});
test('equivalent whitelist sets share equality and hashing', () {
final first = NativeDropConfiguration(
allowedExtensions: ['WAV', 'mp4', 'wav'],
maximumFileCount: 2,
);
final second = NativeDropConfiguration(
allowedExtensions: ['mp4', 'wav'],
maximumFileCount: 2,
);
expect(first, second);
expect(first.hashCode, second.hashCode);
});
}