Skip to content

Commit

Permalink
🧪 Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Dec 11, 2024
1 parent a6fb683 commit 70226d6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/delegates_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,40 @@
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.

import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';

void main() {
group(AssetPickerTextDelegate, () {
test('returns the default when available', () {
expect(
assetPickerTextDelegateFromLocale(null),
equals(const AssetPickerTextDelegate()),
);
expect(
assetPickerTextDelegateFromLocale(const Locale('zh')),
equals(const AssetPickerTextDelegate()),
);
expect(
assetPickerTextDelegateFromLocale(const Locale('zxx')),
equals(const AssetPickerTextDelegate()),
);
});

test('each delegate can be obtained by its locale definition', () {
for (final delegate in assetPickerTextDelegates) {
final locale = Locale.fromSubtags(
languageCode: delegate.languageCode,
scriptCode: delegate.scriptCode,
countryCode: delegate.countryCode,
);
final matchedDelegate = assetPickerTextDelegateFromLocale(locale);
expect(matchedDelegate, equals(delegate));
}
});
});

test('Sort paths correctly', () {
final List<PathWrapper<AssetPathEntity>> paths =
<PathWrapper<AssetPathEntity>>[
Expand Down

0 comments on commit 70226d6

Please sign in to comment.