Skip to content

Commit 2561ef7

Browse files
author
ntwigg
committed
biome the test
1 parent fe8ae09 commit 2561ef7

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

browser-extension/tests/datamodel/handlers/github-handler.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ describe('GitHubHandler', () => {
1717

1818
// Mock window.location for GitHub PR page
1919
Object.defineProperty(window, 'location', {
20-
writable: true,
2120
value: {
2221
hostname: 'github.com',
22+
href: 'https://github.com/diffplug/selfie/pull/517',
2323
pathname: '/diffplug/selfie/pull/517',
24-
href: 'https://github.com/diffplug/selfie/pull/517'
25-
}
24+
},
25+
writable: true,
2626
})
2727

2828
// Create a mock textarea element that mimics GitHub's PR comment box
2929
mockTextarea = document.createElement('textarea')
3030
mockTextarea.name = 'comment[body]'
3131
mockTextarea.placeholder = 'Leave a comment'
3232
mockTextarea.className = 'form-control markdown-body'
33-
33+
3434
// Add it to a typical GitHub comment form structure
3535
const commentForm = document.createElement('div')
3636
commentForm.className = 'js-new-comment-form'
@@ -41,16 +41,16 @@ describe('GitHubHandler', () => {
4141
it('should identify GitHub PR textarea and register it in TextareaRegistry', () => {
4242
// Simulate the content script's enhanceMaybe function
4343
const enhancedTextarea = enhancers.tryToEnhance(mockTextarea)
44-
44+
4545
expect(enhancedTextarea).toBeTruthy()
4646
expect(enhancedTextarea?.element).toBe(mockTextarea)
4747
expect(enhancedTextarea?.spot.type).toBe('GH_PR_ADD_COMMENT')
48-
48+
4949
// Register the enhanced textarea
5050
if (enhancedTextarea) {
5151
enhancedTextareas.register(enhancedTextarea)
5252
}
53-
53+
5454
// Verify it's in the registry
5555
const registeredTextarea = enhancedTextareas.get(mockTextarea)
5656
expect(registeredTextarea).toBeTruthy()
@@ -59,28 +59,28 @@ describe('GitHubHandler', () => {
5959

6060
it('should create correct GitHubContext spot for PR comment', () => {
6161
const enhancedTextarea = enhancers.tryToEnhance(mockTextarea)
62-
62+
6363
expect(enhancedTextarea).toBeTruthy()
64-
64+
6565
// Snapshot test on the spot value
6666
expect(enhancedTextarea?.spot).toMatchSnapshot('github-pr-517-spot')
67-
67+
6868
// Also verify specific expected values
6969
expect(enhancedTextarea?.spot).toMatchObject({
70-
type: 'GH_PR_ADD_COMMENT',
70+
commentId: undefined,
7171
domain: 'github.com',
72-
slug: 'diffplug/selfie',
7372
number: 517,
73+
slug: 'diffplug/selfie',
74+
type: 'GH_PR_ADD_COMMENT',
7475
unique_key: 'github:diffplug/selfie:pull:517',
75-
commentId: undefined
7676
})
7777
})
7878

7979
it('should handle multiple textareas on the same page', () => {
8080
// Create a second textarea for inline code comments
8181
const codeCommentTextarea = document.createElement('textarea')
8282
codeCommentTextarea.className = 'form-control js-suggester-field'
83-
83+
8484
const inlineForm = document.createElement('div')
8585
inlineForm.className = 'js-inline-comment-form'
8686
inlineForm.appendChild(codeCommentTextarea)
@@ -92,7 +92,7 @@ describe('GitHubHandler', () => {
9292

9393
expect(mainCommentEnhanced?.spot.type).toBe('GH_PR_ADD_COMMENT')
9494
expect(codeCommentEnhanced?.spot.type).toBe('GH_PR_CODE_COMMENT')
95-
95+
9696
// Register both
9797
if (mainCommentEnhanced) enhancedTextareas.register(mainCommentEnhanced)
9898
if (codeCommentEnhanced) enhancedTextareas.register(codeCommentEnhanced)
@@ -105,15 +105,15 @@ describe('GitHubHandler', () => {
105105
it('should not enhance textarea on non-GitHub pages', () => {
106106
// Change location to non-GitHub site
107107
Object.defineProperty(window, 'location', {
108-
writable: true,
109108
value: {
110109
hostname: 'example.com',
110+
href: 'https://example.com/some/page',
111111
pathname: '/some/page',
112-
href: 'https://example.com/some/page'
113-
}
112+
},
113+
writable: true,
114114
})
115115

116116
const enhancedTextarea = enhancers.tryToEnhance(mockTextarea)
117117
expect(enhancedTextarea).toBeNull()
118118
})
119-
})
119+
})

0 commit comments

Comments
 (0)