@@ -12,6 +12,7 @@ vi.mock('@nuxt/kit', () => ({
12
12
createResolver : vi . fn ( ) . mockImplementation ( ( ) => ( {
13
13
resolve : vi . fn ( ) . mockImplementation ( path => path ) ,
14
14
} ) ) ,
15
+ installModule : vi . fn ( ) ,
15
16
} ) )
16
17
17
18
describe ( 'Bug LT Module' , ( ) => {
@@ -28,6 +29,7 @@ describe('Bug LT Module', () => {
28
29
it ( 'should have correct default options' , ( ) => {
29
30
expect ( module . defaults ) . toEqual ( {
30
31
enabled : true ,
32
+ ui : true ,
31
33
autoShow : true ,
32
34
position : 'bottom-right' ,
33
35
buttonColor : '#ef4444' ,
@@ -39,13 +41,14 @@ describe('Bug LT Module', () => {
39
41
} )
40
42
} )
41
43
42
- it ( 'should register components correctly' , ( ) => {
44
+ it ( 'should register components correctly' , async ( ) => {
43
45
const mockNuxt = {
44
46
options : {
45
47
runtimeConfig : {
46
48
public : { bugLt : { } } ,
47
49
bugLt : { } ,
48
50
} ,
51
+ modules : [ ] ,
49
52
} ,
50
53
}
51
54
@@ -55,7 +58,7 @@ describe('Bug LT Module', () => {
55
58
autoShow : true ,
56
59
}
57
60
58
- module . setup ( mockOptions , mockNuxt )
61
+ await module . setup ( mockOptions , mockNuxt )
59
62
60
63
expect ( addComponent ) . toHaveBeenCalledWith ( {
61
64
name : 'BugReportButton' ,
@@ -68,39 +71,41 @@ describe('Bug LT Module', () => {
68
71
} )
69
72
} )
70
73
71
- it ( 'should register composables correctly' , ( ) => {
74
+ it ( 'should register composables correctly' , async ( ) => {
72
75
const mockNuxt = {
73
76
options : {
74
77
runtimeConfig : {
75
78
public : { bugLt : { } } ,
76
79
bugLt : { } ,
77
80
} ,
81
+ modules : [ ] ,
78
82
} ,
79
83
}
80
84
81
85
const mockOptions : ModuleOptions = { }
82
86
83
- module . setup ( mockOptions , mockNuxt )
87
+ await module . setup ( mockOptions , mockNuxt )
84
88
85
89
expect ( addImports ) . toHaveBeenCalledWith ( {
86
90
name : 'useBugReport' ,
87
91
from : './runtime/composables/useBugReport' ,
88
92
} )
89
93
} )
90
94
91
- it ( 'should register server handlers correctly' , ( ) => {
95
+ it ( 'should register server handlers correctly' , async ( ) => {
92
96
const mockNuxt = {
93
97
options : {
94
98
runtimeConfig : {
95
99
public : { bugLt : { } } ,
96
100
bugLt : { } ,
97
101
} ,
102
+ modules : [ ] ,
98
103
} ,
99
104
}
100
105
101
106
const mockOptions : ModuleOptions = { }
102
107
103
- module . setup ( mockOptions , mockNuxt )
108
+ await module . setup ( mockOptions , mockNuxt )
104
109
105
110
expect ( addServerHandler ) . toHaveBeenCalledWith ( {
106
111
route : '/api/bug-report' ,
@@ -115,30 +120,32 @@ describe('Bug LT Module', () => {
115
120
} )
116
121
} )
117
122
118
- it ( 'should register plugin correctly' , ( ) => {
123
+ it ( 'should register plugin correctly' , async ( ) => {
119
124
const mockNuxt = {
120
125
options : {
121
126
runtimeConfig : {
122
127
public : { bugLt : { } } ,
123
128
bugLt : { } ,
124
129
} ,
130
+ modules : [ ] ,
125
131
} ,
126
132
}
127
133
128
134
const mockOptions : ModuleOptions = { }
129
135
130
- module . setup ( mockOptions , mockNuxt )
136
+ await module . setup ( mockOptions , mockNuxt )
131
137
132
138
expect ( addPlugin ) . toHaveBeenCalledWith ( './runtime/plugin.client' )
133
139
} )
134
140
135
- it ( 'should configure runtime config correctly' , ( ) => {
141
+ it ( 'should configure runtime config correctly' , async ( ) => {
136
142
const mockNuxt = {
137
143
options : {
138
144
runtimeConfig : {
139
145
public : { bugLt : { } } ,
140
146
bugLt : { } ,
141
147
} ,
148
+ modules : [ ] ,
142
149
} ,
143
150
}
144
151
@@ -151,7 +158,7 @@ describe('Bug LT Module', () => {
151
158
buttonColor : '#ff0000' ,
152
159
}
153
160
154
- module . setup ( mockOptions , mockNuxt )
161
+ await module . setup ( mockOptions , mockNuxt )
155
162
156
163
// Public config should not expose sensitive data
157
164
expect ( mockNuxt . options . runtimeConfig . public . bugLt ) . toEqual ( {
@@ -167,13 +174,14 @@ describe('Bug LT Module', () => {
167
174
} )
168
175
} )
169
176
170
- it ( 'should handle missing linear configuration' , ( ) => {
177
+ it ( 'should handle missing linear configuration' , async ( ) => {
171
178
const mockNuxt = {
172
179
options : {
173
180
runtimeConfig : {
174
181
public : { bugLt : { } } ,
175
182
bugLt : { } ,
176
183
} ,
184
+ modules : [ ] ,
177
185
} ,
178
186
}
179
187
@@ -182,7 +190,7 @@ describe('Bug LT Module', () => {
182
190
position : 'bottom-left' ,
183
191
}
184
192
185
- module . setup ( mockOptions , mockNuxt )
193
+ await module . setup ( mockOptions , mockNuxt )
186
194
187
195
expect ( mockNuxt . options . runtimeConfig . bugLt ) . toEqual ( {
188
196
linearApiKey : undefined ,
@@ -191,19 +199,20 @@ describe('Bug LT Module', () => {
191
199
} )
192
200
} )
193
201
194
- it ( 'should use createResolver to resolve file paths' , ( ) => {
202
+ it ( 'should use createResolver to resolve file paths' , async ( ) => {
195
203
const mockNuxt = {
196
204
options : {
197
205
runtimeConfig : {
198
206
public : { bugLt : { } } ,
199
207
bugLt : { } ,
200
208
} ,
209
+ modules : [ ] ,
201
210
} ,
202
211
}
203
212
204
213
const mockOptions : ModuleOptions = { }
205
214
206
- module . setup ( mockOptions , mockNuxt )
215
+ await module . setup ( mockOptions , mockNuxt )
207
216
208
217
expect ( createResolver ) . toHaveBeenCalledWith ( expect . any ( String ) )
209
218
} )
0 commit comments