Skip to content

Commit 947f9c0

Browse files
committed
tightening test
1 parent 899226f commit 947f9c0

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function testResolvePackages(array $packages, array $expectedRequests, ar
3535
$body = \is_array($expectedRequest['response']['body']) ? json_encode($expectedRequest['response']['body']) : $expectedRequest['response']['body'];
3636
}
3737

38-
return new MockResponse($body, [
39-
'url' => $expectedRequest['response']['url'] ?? '/anything',
40-
]);
38+
return new MockResponse($body);
4139
};
4240
}
4341

@@ -51,6 +49,8 @@ public function testResolvePackages(array $packages, array $expectedRequests, ar
5149
$this->assertArrayHasKey($packageName, $expectedResolvedPackages);
5250
$this->assertSame($expectedResolvedPackages[$packageName]['version'], $package->version);
5351
}
52+
53+
$this->assertSame(count($expectedRequests), $httpClient->getRequestsCount());
5454
}
5555

5656
public static function provideResolvePackagesTests(): iterable
@@ -64,7 +64,6 @@ public static function provideResolvePackagesTests(): iterable
6464
],
6565
[
6666
'url' => '/lodash@1.2.3/+esm',
67-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/lodash.js@1.2.3/+esm'],
6867
],
6968
[
7069
'url' => '/v1/packages/npm/lodash@1.2.3/entrypoints',
@@ -87,7 +86,6 @@ public static function provideResolvePackagesTests(): iterable
8786
],
8887
[
8988
'url' => '/lodash@2.1.3/+esm',
90-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/lodash.js@2.1.3/+esm'],
9189
],
9290
[
9391
'url' => '/v1/packages/npm/lodash@2.1.3/entrypoints',
@@ -110,7 +108,6 @@ public static function provideResolvePackagesTests(): iterable
110108
],
111109
[
112110
'url' => '/@hotwired/stimulus@3.1.3/+esm',
113-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/@hotwired/stimulus.js@3.1.3/+esm'],
114111
],
115112
[
116113
'url' => '/v1/packages/npm/@hotwired/stimulus@3.1.3/entrypoints',
@@ -133,11 +130,6 @@ public static function provideResolvePackagesTests(): iterable
133130
],
134131
[
135132
'url' => '/chart.js@3.0.1/auto/+esm',
136-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/chart.js@3.0.1/auto/+esm'],
137-
],
138-
[
139-
'url' => '/v1/packages/npm/chart.js@3.0.1/entrypoints',
140-
'response' => ['body' => ['entrypoints' => []]],
141133
],
142134
],
143135
'expectedResolvedPackages' => [
@@ -156,11 +148,6 @@ public static function provideResolvePackagesTests(): iterable
156148
],
157149
[
158150
'url' => '/@chart/chart.js@3.0.1/auto/+esm',
159-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/@chart/chart.js@3.0.1/auto/+esm'],
160-
],
161-
[
162-
'url' => '/v1/packages/npm/@chart/chart.js@3.0.1/entrypoints',
163-
'response' => ['body' => ['entrypoints' => []]],
164151
],
165152
],
166153
'expectedResolvedPackages' => [
@@ -180,7 +167,6 @@ public static function provideResolvePackagesTests(): iterable
180167
[
181168
// CSS is detected: +esm is left off
182169
'url' => '/bootstrap@3.3.0/dist/css/bootstrap.min.css',
183-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/bootstrap.js@3.3.0/dist/css/bootstrap.min.css'],
184170
],
185171
],
186172
'expectedResolvedPackages' => [
@@ -199,7 +185,6 @@ public static function provideResolvePackagesTests(): iterable
199185
],
200186
[
201187
'url' => '/bootstrap@5.2.0/+esm',
202-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/bootstrap.js@5.2.0/+esm'],
203188
],
204189
[
205190
'url' => '/v1/packages/npm/bootstrap@5.2.0/entrypoints',
@@ -214,7 +199,6 @@ public static function provideResolvePackagesTests(): iterable
214199
[
215200
// grab the found CSS
216201
'url' => '/bootstrap@5.2.0/dist/css/bootstrap.min.css',
217-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/bootstrap.js@5.2.0/dist/css/bootstrap.min.css'],
218202
],
219203
],
220204
'expectedResolvedPackages' => [
@@ -236,7 +220,6 @@ public static function provideResolvePackagesTests(): iterable
236220
],
237221
[
238222
'url' => '/bootstrap@5.2.0/dist/modal.js/+esm',
239-
'response' => ['url' => 'https://cdn.jsdelivr.net/npm/bootstrap.js@5.2.0/dist/modal.js+esm'],
240223
],
241224
],
242225
'expectedResolvedPackages' => [

0 commit comments

Comments
 (0)