Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/directive-functions-plugin/tests/compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ describe('server function compilation', () => {

export const namedGeneratorFunction = createServerFn(function* namedGeneratorFunction () {
'use server'
return 'hello'
yield 'hello'
return 'hello world'
})

export const arrowFunction = createServerFn(() => {
Expand All @@ -62,7 +63,8 @@ describe('server function compilation', () => {

export const anonymousGeneratorFunction = createServerFn(function* () {
'use server'
return 'hello'
yield 'hello'
return 'hello world'
})

export const multipleDirectives = function multipleDirectives() {
Expand Down Expand Up @@ -98,6 +100,7 @@ describe('server function compilation', () => {

export const namedExportConstGenerator = function* () {
'use server'
yield 'hello'
return usedFn()
}

Expand Down Expand Up @@ -211,7 +214,8 @@ describe('server function compilation', () => {
return 'hello';
});
const namedGeneratorFunction_createServerFn_namedGeneratorFunction = createServerRpc("test_ts--namedGeneratorFunction_createServerFn_namedGeneratorFunction", function* namedGeneratorFunction() {
return 'hello';
yield 'hello';
return 'hello world';
});
const arrowFunction_createServerFn = createServerRpc("test_ts--arrowFunction_createServerFn", () => {
return 'hello';
Expand All @@ -220,7 +224,8 @@ describe('server function compilation', () => {
return 'hello';
});
const anonymousGeneratorFunction_createServerFn = createServerRpc("test_ts--anonymousGeneratorFunction_createServerFn", function* () {
return 'hello';
yield 'hello';
return 'hello world';
});
const multipleDirectives_multipleDirectives = createServerRpc("test_ts--multipleDirectives_multipleDirectives", function multipleDirectives() {
'use strict';
Expand All @@ -243,6 +248,7 @@ describe('server function compilation', () => {
return usedFn();
});
const namedExportConstGenerator_1 = createServerRpc("test_ts--namedExportConstGenerator_1", function* () {
yield 'hello';
return usedFn();
});
function usedFn() {
Expand Down Expand Up @@ -803,6 +809,7 @@ describe('server function compilation', () => {
function* generator() {
'use server'
yield 'hello'
return 'hello world'
}
`
const client = compileDirectives({
Expand Down Expand Up @@ -831,6 +838,7 @@ describe('server function compilation', () => {
"import { createServerRpc } from "my-rpc-lib-server";
const generator_1 = createServerRpc("test_ts--generator_1", function* () {
yield 'hello';
return 'hello world';
});
const generator = generator_1;
export { generator_1 };"`)
Expand All @@ -840,6 +848,7 @@ describe('server function compilation', () => {
async function* asyncGenerator() {
'use server'
yield 'hello'
return 'hello world'
}
`
const client = compileDirectives({
Expand Down Expand Up @@ -868,6 +877,7 @@ describe('server function compilation', () => {
"import { createServerRpc } from "my-rpc-lib-server";
const asyncGenerator_1 = createServerRpc("test_ts--asyncGenerator_1", async function* () {
yield 'hello';
return 'hello world';
});
const asyncGenerator = asyncGenerator_1;
export { asyncGenerator_1 };"`)
Expand Down