forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1import { describe, expect, it } from 'vitest'
2
3import { buildScopeTeam } from '../../../../../app/utils/npm/common'
4import { validateScopeTeam } from '../../../../../cli/src/npm-client'
5
6describe('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})