2022-12-01 22:59:08 +00:00
|
|
|
import { describe, expect, it } from 'vitest'
|
2023-01-29 13:20:37 +00:00
|
|
|
import { HANDLED_MASTO_URLS } from '~/constants'
|
2022-12-01 22:59:08 +00:00
|
|
|
|
|
|
|
const validPermalinks = [
|
|
|
|
'https://m1as-social34.to.social/@elk',
|
|
|
|
'https://m1as-social34.to.social/@elk22/123',
|
|
|
|
'https://m1as-social34.to.social/@elk22/objects/123',
|
2023-01-16 10:24:14 +00:00
|
|
|
'webtoo.ls/@elk',
|
2022-12-01 22:59:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
const invalidPermalinks = [
|
2023-01-16 10:24:14 +00:00
|
|
|
'https://webtoo.ls',
|
|
|
|
'https://webtoo.ls/elk/123',
|
2022-12-01 22:59:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
describe('permalinks', () => {
|
|
|
|
it.each(validPermalinks)('should recognise %s', (url) => {
|
|
|
|
expect(HANDLED_MASTO_URLS.test(url)).toBe(true)
|
|
|
|
})
|
|
|
|
it.each(invalidPermalinks)('should not recognise %s', (url) => {
|
|
|
|
expect(HANDLED_MASTO_URLS.test(url)).toBe(false)
|
|
|
|
})
|
|
|
|
})
|