@dfosco/storyboard-core 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/comments/config.js
CHANGED
|
@@ -19,10 +19,11 @@ export function initCommentsConfig(rawConfig, options = {}) {
|
|
|
19
19
|
return
|
|
20
20
|
}
|
|
21
21
|
const c = rawConfig.comments
|
|
22
|
+
const r = rawConfig.repository
|
|
22
23
|
_config = {
|
|
23
24
|
repo: {
|
|
24
|
-
owner:
|
|
25
|
-
name:
|
|
25
|
+
owner: r?.owner ?? '',
|
|
26
|
+
name: r?.name ?? '',
|
|
26
27
|
},
|
|
27
28
|
discussions: {
|
|
28
29
|
category: c.discussions?.category ?? 'Storyboard Comments',
|
|
@@ -8,8 +8,8 @@ describe('initCommentsConfig', () => {
|
|
|
8
8
|
|
|
9
9
|
it('initializes config from valid rawConfig', () => {
|
|
10
10
|
initCommentsConfig({
|
|
11
|
+
repository: { owner: 'dfosco', name: 'storyboard' },
|
|
11
12
|
comments: {
|
|
12
|
-
repo: { owner: 'dfosco', name: 'storyboard' },
|
|
13
13
|
discussions: { category: 'Comments' },
|
|
14
14
|
},
|
|
15
15
|
})
|
|
@@ -23,9 +23,8 @@ describe('initCommentsConfig', () => {
|
|
|
23
23
|
|
|
24
24
|
it('uses default category when not provided', () => {
|
|
25
25
|
initCommentsConfig({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
26
|
+
repository: { owner: 'owner', name: 'repo' },
|
|
27
|
+
comments: {},
|
|
29
28
|
})
|
|
30
29
|
const config = getCommentsConfig()
|
|
31
30
|
expect(config.discussions.category).toBe('Storyboard Comments')
|
|
@@ -41,7 +40,7 @@ describe('initCommentsConfig', () => {
|
|
|
41
40
|
expect(getCommentsConfig()).toBeNull()
|
|
42
41
|
})
|
|
43
42
|
|
|
44
|
-
it('handles missing
|
|
43
|
+
it('handles missing repository fields gracefully', () => {
|
|
45
44
|
initCommentsConfig({ comments: {} })
|
|
46
45
|
const config = getCommentsConfig()
|
|
47
46
|
expect(config.repo.owner).toBe('')
|
|
@@ -59,18 +58,19 @@ describe('isCommentsEnabled', () => {
|
|
|
59
58
|
})
|
|
60
59
|
|
|
61
60
|
it('returns false when owner is empty', () => {
|
|
62
|
-
initCommentsConfig({
|
|
61
|
+
initCommentsConfig({ repository: { owner: '', name: 'repo' }, comments: {} })
|
|
63
62
|
expect(isCommentsEnabled()).toBe(false)
|
|
64
63
|
})
|
|
65
64
|
|
|
66
65
|
it('returns false when name is empty', () => {
|
|
67
|
-
initCommentsConfig({
|
|
66
|
+
initCommentsConfig({ repository: { owner: 'owner', name: '' }, comments: {} })
|
|
68
67
|
expect(isCommentsEnabled()).toBe(false)
|
|
69
68
|
})
|
|
70
69
|
|
|
71
70
|
it('returns true when both owner and name are set', () => {
|
|
72
71
|
initCommentsConfig({
|
|
73
|
-
|
|
72
|
+
repository: { owner: 'dfosco', name: 'storyboard' },
|
|
73
|
+
comments: {},
|
|
74
74
|
})
|
|
75
75
|
expect(isCommentsEnabled()).toBe(true)
|
|
76
76
|
})
|