[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 49 lines 1.6 kB view raw
1import { describe, expect, it } from 'vitest' 2 3// Test the URL parsing logic directly by importing from the composable 4// Since it's not exported, we'll test the behavior through the expected patterns 5 6describe('repository URL parsing patterns', () => { 7 const testUrls = { 8 github: [ 9 'https://github.com/nuxt/nuxt', 10 'git+https://github.com/nuxt/nuxt.git', 11 'git@github.com:nuxt/nuxt.git', 12 'https://www.github.com/nuxt/nuxt', 13 ], 14 gitlab: [ 15 'https://gitlab.com/gitlab-org/gitlab', 16 'git+https://gitlab.com/hyper-expanse/open-source/semantic-release-gitlab.git', 17 'https://gitlab.com/remcohaszing/eslint-formatter-gitlab', 18 ], 19 codeberg: [ 20 'https://codeberg.org/jgarber/CashCash', 21 'git+https://codeberg.org/fftcc/codeberg-pages.git', 22 ], 23 sourcehut: ['https://git.sr.ht/~ayoayco/astro-resume', 'https://sr.ht/~sthagen/konfiguroida'], 24 } 25 26 describe('GitHub URLs', () => { 27 it.each(testUrls.github)('should match GitHub URL: %s', url => { 28 expect(url).toMatch(/github\.com/i) 29 }) 30 }) 31 32 describe('GitLab URLs', () => { 33 it.each(testUrls.gitlab)('should match GitLab URL: %s', url => { 34 expect(url).toMatch(/gitlab\.com/i) 35 }) 36 }) 37 38 describe('Codeberg URLs', () => { 39 it.each(testUrls.codeberg)('should match Codeberg URL: %s', url => { 40 expect(url).toMatch(/codeberg\.org/i) 41 }) 42 }) 43 44 describe('Sourcehut URLs', () => { 45 it.each(testUrls.sourcehut)('should match Sourcehut URL: %s', url => { 46 expect(url).toMatch(/sr\.ht/i) 47 }) 48 }) 49})