Skip to content

Commit 5c5d3e7

Browse files
Merge branch 'main' into dependabot/pub/mockito-5.5.0
2 parents aa32bb8 + dd34beb commit 5c5d3e7

File tree

4 files changed

+50
-37
lines changed

4 files changed

+50
-37
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
# Created by `dart pub`
33
.dart_tool/
44
.idea/
5+
6+
build/

pubspec.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ packages:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: f6154230675c44a191f2e20d16eeceb4aa18b30ca732db4efaf94c6a7d43cfa6
16+
sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d"
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "7.5.2"
19+
version: "7.7.1"
2020
args:
2121
dependency: "direct main"
2222
description:
@@ -45,10 +45,10 @@ packages:
4545
dependency: transitive
4646
description:
4747
name: build
48-
sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7"
48+
sha256: "7d95cbbb1526ab5ae977df9b4cc660963b9b27f6d1075c0b34653868911385e4"
4949
url: "https://pub.dev"
5050
source: hosted
51-
version: "2.5.4"
51+
version: "3.0.0"
5252
build_config:
5353
dependency: transitive
5454
description:
@@ -69,26 +69,26 @@ packages:
6969
dependency: transitive
7070
description:
7171
name: build_resolvers
72-
sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62
72+
sha256: "38c9c339333a09b090a638849a4c56e70a404c6bdd3b511493addfbc113b60c2"
7373
url: "https://pub.dev"
7474
source: hosted
75-
version: "2.5.4"
75+
version: "3.0.0"
7676
build_runner:
7777
dependency: "direct dev"
7878
description:
7979
name: build_runner
80-
sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53"
80+
sha256: b971d4a1c789eba7be3e6fe6ce5e5b50fd3719e3cb485b3fad6d04358304351d
8181
url: "https://pub.dev"
8282
source: hosted
83-
version: "2.5.4"
83+
version: "2.6.0"
8484
build_runner_core:
8585
dependency: transitive
8686
description:
8787
name: build_runner_core
88-
sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792"
88+
sha256: c04e612ca801cd0928ccdb891c263a2b1391cb27940a5ea5afcf9ba894de5d62
8989
url: "https://pub.dev"
9090
source: hosted
91-
version: "9.1.2"
91+
version: "9.2.0"
9292
built_collection:
9393
dependency: transitive
9494
description:
@@ -293,10 +293,10 @@ packages:
293293
dependency: "direct dev"
294294
description:
295295
name: mockito
296-
sha256: "4546eac99e8967ea91bae633d2ca7698181d008e95fa4627330cf903d573277a"
296+
sha256: "2314cbe9165bcd16106513df9cf3c3224713087f09723b128928dc11a4379f99"
297297
url: "https://pub.dev"
298298
source: hosted
299-
version: "5.4.6"
299+
version: "5.5.0"
300300
node_preamble:
301301
dependency: transitive
302302
description:
@@ -381,10 +381,10 @@ packages:
381381
dependency: transitive
382382
description:
383383
name: source_gen
384-
sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b"
384+
sha256: fc787b1f89ceac9580c3616f899c9a447413cbdac1df071302127764c023a134
385385
url: "https://pub.dev"
386386
source: hosted
387-
version: "2.0.0"
387+
version: "3.0.0"
388388
source_map_stack_trace:
389389
dependency: transitive
390390
description:

test/sourcemaps/sourcemap_api_test.dart

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,29 @@ void main() {
1313
group('SourcemapApi', () {
1414
late MockClient mockClient;
1515
late SourcemapApi sourcemapApi;
16+
late File testFile;
1617

1718
setUp(() {
1819
mockClient = MockClient();
1920
sourcemapApi = SourcemapApi(httpClient: mockClient);
21+
// Create a temporary test file
22+
testFile = File('test_sourcemap.js.map');
23+
testFile.writeAsStringSync('{"version": 3, "sources": ["test.js"]}');
24+
});
25+
26+
tearDown(() {
27+
// Clean up the test file after all tests
28+
try {
29+
if (testFile.existsSync()) {
30+
testFile.deleteSync();
31+
}
32+
} catch (e) {
33+
// Ignore if the file cannot be deleted
34+
}
2035
});
2136

2237
group('uploadSourcemap', () {
2338
test('returns true when upload is successful (200)', () async {
24-
// Create a temporary test file
25-
final testFile = File('test_sourcemap.js.map');
26-
testFile.writeAsStringSync('{"version": 3, "sources": ["test.js"]}');
27-
2839
final response = http.StreamedResponse(
2940
Stream.value([]),
3041
200,
@@ -35,21 +46,15 @@ void main() {
3546
final result = await sourcemapApi.uploadSourcemap(
3647
appId: 'test-app-id',
3748
token: 'test-token',
38-
path: 'test_sourcemap.js.map',
49+
path: testFile.path,
3950
uri: 'https://example.com/app.js',
4051
);
4152

4253
expect(result, true);
4354
verify(mockClient.send(any)).called(1);
44-
45-
// Clean up
46-
testFile.deleteSync();
4755
});
4856

4957
test('returns false when upload fails', () async {
50-
final testFile = File('test_sourcemap.js.map');
51-
testFile.writeAsStringSync('{"version": 3, "sources": ["test.js"]}');
52-
5358
final response = http.StreamedResponse(
5459
Stream.value([]),
5560
400,
@@ -60,13 +65,11 @@ void main() {
6065
final result = await sourcemapApi.uploadSourcemap(
6166
appId: 'test-app-id',
6267
token: 'test-token',
63-
path: 'test_sourcemap.js.map',
68+
path: testFile.path,
6469
uri: 'https://example.com/app.js',
6570
);
6671

6772
expect(result, false);
68-
69-
testFile.deleteSync();
7073
});
7174

7275
test('returns false when file does not exist', () async {

test/sourcemaps/sourcemap_command_test.dart

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,29 @@ void main() {
1212
group('SourcemapCommand', () {
1313
late MockSourcemapApi mockApi;
1414
late SourcemapCommand command;
15+
late File testFile;
1516

1617
setUp(() {
1718
mockApi = MockSourcemapApi();
1819
command = SourcemapCommand(api: mockApi);
20+
// Create a temporary test file
21+
testFile = File('test_sourcemap.js.map');
22+
testFile.writeAsStringSync('{"version": 3, "sources": ["test.js"]}');
23+
});
24+
25+
tearDown(() {
26+
// Clean up the test file after all tests
27+
try {
28+
if (testFile.existsSync()) {
29+
testFile.deleteSync();
30+
}
31+
} catch (e) {
32+
// Ignore if the file cannot be deleted
33+
}
1934
});
2035

2136
group('run', () {
2237
test('handles single file upload (platform null)', () async {
23-
// Create a temporary test file
24-
final testFile = File('test_sourcemap.js.map');
25-
testFile.writeAsStringSync('{"version": 3, "sources": ["test.js"]}');
26-
2738
when(mockApi.uploadSourcemap(
2839
appId: anyNamed('appId'),
2940
token: anyNamed('token'),
@@ -39,7 +50,7 @@ void main() {
3950
'--app-id=test-app-id',
4051
'--token=test-token',
4152
'--uri=http://test.com/app.js',
42-
'--input-map=test_sourcemap.js.map'
53+
'--input-map=${testFile.path}',
4354
]);
4455

4556
final result = await command.run(
@@ -51,12 +62,9 @@ void main() {
5162
verify(mockApi.uploadSourcemap(
5263
appId: 'test-app-id',
5364
token: 'test-token',
54-
path: 'test_sourcemap.js.map',
65+
path: testFile.path,
5566
uri: 'http://test.com/app.js',
5667
)).called(1);
57-
58-
// Clean up
59-
testFile.deleteSync();
6068
});
6169

6270
test('handles flutter platform upload', () async {

0 commit comments

Comments
 (0)