1+ /**
2+ * Copyright 2026 Arm Limited
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ import 'jest' ;
18+ import { packURL } from './pack-urls' ;
19+
20+ describe ( 'packURL' , ( ) => {
21+ it ( 'returns a versions URL for a versioned pack ID' , ( ) => {
22+ expect ( packURL ( 'My::Pack@1.2.3' , 'versions' ) ) . toBe ( 'https://www.keil.arm.com/packs/pack-my/versions/' ) ;
23+ } ) ;
24+
25+ it ( 'returns a base URL for a versioned pack ID when suffix is undefined' , ( ) => {
26+ expect ( packURL ( 'My::Pack@1.2.3' , undefined ) ) . toBe ( 'https://www.keil.arm.com/packs/pack-my/' ) ;
27+ } ) ;
28+
29+ it ( 'returns a versions URL for a versionless pack ID' , ( ) => {
30+ expect ( packURL ( 'My::Pack' , 'versions' ) ) . toBe ( 'https://www.keil.arm.com/packs/pack-my/versions/' ) ;
31+ } ) ;
32+
33+ it ( 'returns a base URL for a versionless pack ID when suffix is undefined' , ( ) => {
34+ expect ( packURL ( 'My::Pack' , undefined ) ) . toBe ( 'https://www.keil.arm.com/packs/pack-my/' ) ;
35+ } ) ;
36+
37+ it ( 'returns the base packs URL for an empty pack ID when suffix is provided' , ( ) => {
38+ expect ( packURL ( '' , 'versions' ) ) . toBe ( 'https://www.keil.arm.com/packs' ) ;
39+ } ) ;
40+
41+ it ( 'returns the base packs URL for an empty pack ID when suffix is undefined' , ( ) => {
42+ expect ( packURL ( '' , undefined ) ) . toBe ( 'https://www.keil.arm.com/packs' ) ;
43+ } ) ;
44+ } ) ;
0 commit comments