Makes control.js testable with various config. changes. Adds coverage for util.js, roles.js, starts on control.js. Updates the entrypoint; untested so far

This commit is contained in:
Ben Menesini
2024-05-19 19:36:02 -07:00
parent e14c6f1685
commit db7338bcf3
11 changed files with 1483 additions and 767 deletions

17
src/util.test.js Normal file
View File

@@ -0,0 +1,17 @@
import { ensureValidURL } from './util'
describe('ensureValidURL', () => {
it('should not throw an error for valid http and https URLs', () => {
expect(() => ensureValidURL('http://example.com')).not.toThrow()
expect(() => ensureValidURL('https://example.com')).not.toThrow()
})
it('should throw an error for non-http and non-https URLs', () => {
expect(() => ensureValidURL('ftp://example.com')).toThrow()
expect(() => ensureValidURL('file://example.com')).toThrow()
})
it('should throw an error for invalid URLs', () => {
expect(() => ensureValidURL('invalid')).toThrow()
})
})