Skip to content

Commit 1c17b06

Browse files
committed
add unit test
1 parent 26c5cd6 commit 1c17b06

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/about_us_screen_version_test.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,33 @@ void main() {
5656
expect(version, '9.8.7+45');
5757
},
5858
);
59+
60+
test('uses version in default path from package', () async {
61+
final executablePath =
62+
'${Platform.pathSeparator}usr${Platform.pathSeparator}bin${Platform.pathSeparator}'
63+
'pslab';
64+
final versionFile = File(
65+
'${Platform.pathSeparator}usr${Platform.pathSeparator}bin${Platform.pathSeparator}'
66+
'data${Platform.pathSeparator}flutter_assets${Platform.pathSeparator}'
67+
'version.json',
68+
);
69+
70+
IOOverrides.runZoned(() async {
71+
await versionFile.create(recursive: true);
72+
await versionFile.writeAsString('{"version":"6.5.3"}');
73+
74+
final version = await resolveAboutUsVersion(
75+
packageInfoLoader: () async => PackageInfo(
76+
appName: 'pslab',
77+
packageName: 'io.pslab',
78+
version: '',
79+
buildNumber: '1234',
80+
),
81+
isLinux: true,
82+
resolvedExecutable: executablePath,
83+
);
84+
85+
expect(version, '6.5.3+1234');
86+
});
87+
});
5988
}

0 commit comments

Comments
 (0)