removed submodule

This commit is contained in:
2023-12-21 16:50:58 -05:00
207 changed files with 30648 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
import { checkNewRelease } from '../../../src/utils/dates.js'
describe('date utils', () => {
describe('checkNewRelease', () => {
it("returns a positive result checking today's date", () => {
expect(checkNewRelease(new Date())).toBe(true)
})
it("returns a negative result checking a week ago's date", () => {
const dateToCheck = new Date()
dateToCheck.setDate(dateToCheck.getDate() - 7)
expect(checkNewRelease(dateToCheck)).toBe(false)
})
})
})

View File

@@ -0,0 +1,12 @@
import { aggregateDownloadLinks } from '../../../src/utils/downloads'
describe('download utils', () => {
describe('aggregateDownloadLinks', () => {
it('merges links into a single string', () => {
const release = { link: 'abcde' }
const aggregated = aggregateDownloadLinks([release, release])
expect(aggregated).toBe('abcde;abcde')
})
})
})

View File

@@ -0,0 +1,17 @@
import { upperCaseFirstLowerCaseRest } from '../../../src/utils/texts'
describe('texts utils', () => {
describe('upperCaseFirstLowerCaseRest', () => {
it('converts a full uppercase string', () => {
expect(upperCaseFirstLowerCaseRest('TEST STRING')).toBe('Test string')
})
it('converts a full lowercase string', () => {
expect(upperCaseFirstLowerCaseRest('test string')).toBe('Test string')
})
it('converts a mixed string', () => {
expect(upperCaseFirstLowerCaseRest("i wOn'T woRK")).toBe("I won't work")
})
})
})

View File

@@ -0,0 +1,33 @@
import { isValidURL, convertDuration, convertDurationSeparated } from '../../../src/utils/utils'
describe('utils utils (needs refactor)', () => {
describe('isValidURL', () => {
it('returns a positive result with all supported URLs', () => {
expect(isValidURL('https://www.deezer.com')).toBe(true)
expect(isValidURL('https://deezer.page.link')).toBe(true)
expect(isValidURL('https://open.spotify.com')).toBe(true)
expect(isValidURL('https://link.tospotify.com')).toBe(true)
expect(isValidURL('spotify:something')).toBe(true)
})
it('returns a negative result with a not supported URL', () => {
expect(isValidURL('https://www.google.com')).toBe(false)
})
})
describe('convertDuration', () => {
it('converts seconds in the correct format', () => {
expect(convertDuration(120)).toBe('2:00')
expect(convertDuration(60)).toBe('1:00')
expect(convertDuration(30)).toBe('0:30')
})
})
describe('convertDurationSeparated', () => {
it('converts seconds in the correct format', () => {
expect(convertDurationSeparated(120)).toStrictEqual([0, 2, 0])
expect(convertDurationSeparated(60)).toStrictEqual([0, 1, 0])
expect(convertDurationSeparated(30)).toStrictEqual([0, 0, 30])
})
})
})