Skip to content

Commit 97948e7

Browse files
committed
tests
1 parent 597f6e5 commit 97948e7

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

browser-extension/tests/lib/enhancers/github.test.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expect
66
import { EnhancerRegistry } from '../../../src/lib/registries'
77

88
describe('github', () => {
9-
usingHar('gh_pr').it('should create the correct spot object', async () => {
9+
usingHar('gh_pr').it('should create the correct spot object for gh_pr', async () => {
1010
const enhancers = new EnhancerRegistry()
1111
const textareas = document.querySelectorAll('textarea')
1212
expect(textareas.length).toBe(2)
@@ -21,7 +21,20 @@ describe('github', () => {
2121
}
2222
`)
2323
})
24-
usingHar('gh_issue').it('should create the correct spot object', async () => {
24+
usingHar('gh_new_pr').it('should create the correct spot object for gh_new_pr', async () => {
25+
const enhancers = new EnhancerRegistry()
26+
const textareas = document.querySelectorAll('textarea')
27+
expect(textareas.length).toBe(2)
28+
expect(enhancers.tryToEnhance(textareas[0]!)?.spot).toMatchInlineSnapshot(`
29+
{
30+
"domain": "github.com",
31+
"slug": "diffplug/selfie/main...cavia-porcellus:selfie:main",
32+
"type": "GH_PR_NEW_COMMENT",
33+
"unique_key": "github.com:diffplug/selfie/main...cavia-porcellus:selfie:main",
34+
}
35+
`)
36+
})
37+
usingHar('gh_issue').it('should create the correct spot object for gh_issue', async () => {
2538
const enhancers = new EnhancerRegistry()
2639
const textareas = document.querySelectorAll('textarea')
2740
expect(textareas.length).toBe(1)
@@ -35,4 +48,19 @@ describe('github', () => {
3548
}
3649
`)
3750
})
51+
usingHar(
52+
'gh_new_issue',
53+
).it('should create the correct spot object for gh_new_issue', async () => {
54+
const enhancers = new EnhancerRegistry()
55+
const textareas = document.querySelectorAll('textarea')
56+
expect(textareas.length).toBe(1)
57+
expect(enhancers.tryToEnhance(textareas[0]!)?.spot).toMatchInlineSnapshot(`
58+
{
59+
"domain": "github.com",
60+
"slug": "diffplug/selfie",
61+
"type": "GH_ISSUE_NEW_COMMENT",
62+
"unique_key": "github.com:diffplug/selfie:new",
63+
}
64+
`)
65+
})
3866
})

0 commit comments

Comments
 (0)