removed submodule
This commit is contained in:
16
webui/tests/unit/utils/dates.spec.js
Normal file
16
webui/tests/unit/utils/dates.spec.js
Normal 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)
|
||||
})
|
||||
})
|
||||
})
|
||||
12
webui/tests/unit/utils/downloads.spec.js
Normal file
12
webui/tests/unit/utils/downloads.spec.js
Normal 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')
|
||||
})
|
||||
})
|
||||
})
|
||||
17
webui/tests/unit/utils/texts.spec.js
Normal file
17
webui/tests/unit/utils/texts.spec.js
Normal 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")
|
||||
})
|
||||
})
|
||||
})
|
||||
33
webui/tests/unit/utils/utils.spec.js
Normal file
33
webui/tests/unit/utils/utils.spec.js
Normal 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])
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user