Skip to content

Commit a39d837

Browse files
authored
test(rsc): fix invalid code (#722)
1 parent d33f37d commit a39d837

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/plugin-rsc/src/transforms/wrap-export.test.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ export const a = 0;
227227
export const b = function() {}
228228
export const c = () => {}
229229
export default function d() {}
230-
export default () => {}
231230
`
232231
const result = await testTransform(input, {
233232
filter: (_name, meta) => !!(meta.isFunction && meta.declName),
@@ -238,7 +237,6 @@ export default () => {}
238237
let b = function() {}
239238
let c = () => {}
240239
function d() {}
241-
const $$default = () => {}
242240
export { a };
243241
b = /* #__PURE__ */ $$wrap(b, "<id>", "b");
244242
export { b };
@@ -247,6 +245,21 @@ export default () => {}
247245
;
248246
const $$wrap_d = /* #__PURE__ */ $$wrap(d, "<id>", "default");
249247
export { $$wrap_d as default };
248+
"
249+
`)
250+
})
251+
252+
test('filter meta 2', async () => {
253+
const input = `
254+
export default () => {}
255+
`
256+
const result = await testTransform(input, {
257+
filter: (_name, meta) => !!(meta.isFunction && meta.declName),
258+
})
259+
expect(result).toMatchInlineSnapshot(`
260+
"
261+
const $$default = () => {}
262+
;
250263
export { $$default as default };
251264
"
252265
`)

0 commit comments

Comments
 (0)