Skip to content

Commit

Permalink
style: expand print width to 100 characters
Browse files Browse the repository at this point in the history
Adjusted code formatting to adhere to a maximum print width of 100
characters, improving readability and consistency across the codebase.
  • Loading branch information
chessurisme committed Jun 13, 2024
1 parent 047f868 commit d02f0cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
32 changes: 8 additions & 24 deletions src/utilities/components/__tests__/set-attributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe('setAttributes', () => {
})

it('should return false when element is not provided', () => {
const spyConsoleError = jest
.spyOn(console, 'error')
.mockImplementation(() => {})
const spyConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
const attributes = {
id: 'sample-div',
class: 'container',
Expand All @@ -37,38 +35,28 @@ describe('setAttributes', () => {

const result = setAttributes(null, attributes)

expect(spyConsoleError).toHaveBeenCalledWith(
'The element must be provided.'
)
expect(spyConsoleError).toHaveBeenCalledWith('The element must be provided.')
expect(result).toBe(false)
spyConsoleError.mockRestore()
})

it('should return false when attributes are not provided or empty', () => {
const spyConsoleError = jest
.spyOn(console, 'error')
.mockImplementation(() => {})
const spyConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
const element = document.createElement('div')

const resultEmpty = setAttributes(element, {})
expect(spyConsoleError).toHaveBeenCalledWith(
'The attributes must be provided.'
)
expect(spyConsoleError).toHaveBeenCalledWith('The attributes must be provided.')
expect(resultEmpty).toBe(false)

const resultNull = setAttributes(element, null)
expect(spyConsoleError).toHaveBeenCalledWith(
'The attributes must be provided.'
)
expect(spyConsoleError).toHaveBeenCalledWith('The attributes must be provided.')
expect(resultNull).toBe(false)

spyConsoleError.mockRestore()
})

it('should return false when element provided is not a valid HTML element', () => {
const spyConsoleError = jest
.spyOn(console, 'error')
.mockImplementation(() => {})
const spyConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
const element = 'not an HTML element'
const attributes = {
id: 'sample-div',
Expand All @@ -86,17 +74,13 @@ describe('setAttributes', () => {
})

it('should return false when attributes provided are not a valid object', () => {
const spyConsoleError = jest
.spyOn(console, 'error')
.mockImplementation(() => {})
const spyConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
const element = document.createElement('div')
const attributes = 'not an object'

const result = setAttributes(element, attributes)

expect(spyConsoleError).toHaveBeenCalledWith(
'The attributes provided are not a valid object.'
)
expect(spyConsoleError).toHaveBeenCalledWith('The attributes provided are not a valid object.')
expect(result).toBe(false)
spyConsoleError.mockRestore()
})
Expand Down
4 changes: 3 additions & 1 deletion src/utilities/components/__tests__/set-events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ describe('setEvents', () => {
})

it('should return false when events are not provided', () => {
const spyConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {})
const spyConsoleError = jest
.spyOn(console, 'error')
.mockImplementation(() => {})
const element = document.createElement('div')

const result = setEvents(element, null)
Expand Down

0 comments on commit d02f0cd

Please sign in to comment.