File tree Expand file tree Collapse file tree 3 files changed +29
-53
lines changed
Expand file tree Collapse file tree 3 files changed +29
-53
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest'
2+
3+ import { buildScopeTeam } from '../../../../../app/utils/npm/common'
4+ import { validateScopeTeam } from '../../../../../cli/src/npm-client'
5+
6+ describe ( 'buildScopeTeam' , ( ) => {
7+ it ( 'constructs scope:team with @ prefix' , ( ) => {
8+ expect ( buildScopeTeam ( 'netlify' , 'developers' ) ) . toBe ( '@netlify:developers' )
9+ expect ( buildScopeTeam ( 'nuxt' , 'core' ) ) . toBe ( '@nuxt:core' )
10+ } )
11+
12+ it ( 'strips existing @ prefix from orgName' , ( ) => {
13+ expect ( buildScopeTeam ( '@netlify' , 'developers' ) ) . toBe ( '@netlify:developers' )
14+ expect ( buildScopeTeam ( '@nuxt' , 'core' ) ) . toBe ( '@nuxt:core' )
15+ } )
16+
17+ it ( 'produces format accepted by validateScopeTeam' , ( ) => {
18+ expect ( ( ) => validateScopeTeam ( buildScopeTeam ( 'netlify' , 'developers' ) ) ) . not . toThrow ( )
19+ expect ( ( ) => validateScopeTeam ( buildScopeTeam ( 'nuxt' , 'core' ) ) ) . not . toThrow ( )
20+ expect ( ( ) => validateScopeTeam ( buildScopeTeam ( 'my-org' , 'my-team' ) ) ) . not . toThrow ( )
21+ } )
22+ } )
Original file line number Diff line number Diff line change @@ -25,19 +25,25 @@ describe('spdx utilities', () => {
2525 } )
2626
2727 describe ( 'getSpdxLicenseUrl' , ( ) => {
28- it ( 'returns URL for valid SPDX licenses ' , ( ) => {
28+ it ( 'returns URL for valid license identifiers ' , ( ) => {
2929 expect ( getSpdxLicenseUrl ( 'MIT' ) ) . toBe ( 'https://spdx.org/licenses/MIT.html' )
30+ expect ( getSpdxLicenseUrl ( 'ISC' ) ) . toBe ( 'https://spdx.org/licenses/ISC.html' )
3031 expect ( getSpdxLicenseUrl ( 'Apache-2.0' ) ) . toBe ( 'https://spdx.org/licenses/Apache-2.0.html' )
32+ expect ( getSpdxLicenseUrl ( 'GPL-3.0-only' ) ) . toBe ( 'https://spdx.org/licenses/GPL-3.0-only.html' )
33+ expect ( getSpdxLicenseUrl ( 'BSD-2-Clause' ) ) . toBe ( 'https://spdx.org/licenses/BSD-2-Clause.html' )
34+ expect ( getSpdxLicenseUrl ( 'GPL-3.0+' ) ) . toBe ( 'https://spdx.org/licenses/GPL-3.0+.html' )
3135 } )
3236
3337 it ( 'returns null for invalid licenses' , ( ) => {
3438 expect ( getSpdxLicenseUrl ( 'CustomLicense' ) ) . toBeNull ( )
3539 expect ( getSpdxLicenseUrl ( 'INVALID' ) ) . toBeNull ( )
40+ expect ( getSpdxLicenseUrl ( 'MIT OR Apache-2.0' ) ) . toBeNull ( )
3641 } )
3742
3843 it ( 'returns null for undefined or empty' , ( ) => {
3944 expect ( getSpdxLicenseUrl ( undefined ) ) . toBeNull ( )
4045 expect ( getSpdxLicenseUrl ( '' ) ) . toBeNull ( )
46+ expect ( getSpdxLicenseUrl ( ' ' ) ) . toBeNull ( )
4147 } )
4248
4349 it ( 'trims whitespace' , ( ) => {
You can’t perform that action at this time.
0 commit comments