Skip to content
Open
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletions .github/workflows/ci-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 🍓 Fork CI

# Builds and tests the forked StrawberryShake runtime packages (Razor + Core), including a
# bUnit smoke test. Scoped to what the fork touches - not the full upstream monorepo matrix.
# The Razor codegen snapshot tests bake the generator assembly version (0.0.0.0 locally vs the
# stamped version in CI) so they are not CI-portable and are not run here.

on:
pull_request:
push:
branches:
- fork
- "release/fork-*"

permissions:
contents: read

jobs:
test:
name: Build & test forked packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Install .NET
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: |
8.x
9.x
10.x
11.0.100-preview.5.26302.115

- name: Test StrawberryShake.Razor (runtime + bUnit)
run: dotnet test src/StrawberryShake/Client/test/Razor.Tests/StrawberryShake.Razor.Tests.csproj -c Release

- name: Test StrawberryShake.Core
run: dotnet test src/StrawberryShake/Client/test/Core.Tests/StrawberryShake.Core.Tests.csproj -c Release
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<PackageVersion Include="System.Net.ServerSentEvents" Version="10.0.0" />
<PackageVersion Include="System.Reactive" Version="6.1.0" />
<PackageVersion Include="Testcontainers" Version="4.11.0" />
<PackageVersion Include="bunit" Version="2.7.2" />
<PackageVersion Include="xunit.assert" Version="2.9.3" />
<PackageVersion Include="xunit.extensibility.core" Version="2.9.3" />
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Razor\StrawberryShake.Razor.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Bunit;

namespace StrawberryShake.Razor;

/// <summary>
/// Smoke tests confirming bUnit can render the StrawberryShake.Razor components.
/// </summary>
public class UseFragmentBunitTests : BunitContext
{
[Fact]
public void Renders_ChildContent_When_Data_Is_Present()
{
// arrange & act
var cut = Render<UseFragment<string>>(parameters => parameters
.Add(p => p.Data, "Strawberry")
.Add(p => p.ChildContent, data => $"<span>{data}</span>"));

// assert
cut.MarkupMatches("<span>Strawberry</span>");
}

[Fact]
public void Renders_LoadingContent_When_Data_Is_Null()
{
// arrange & act
var cut = Render<UseFragment<string>>(parameters => parameters
.Add(p => p.LoadingContent, "<em>loading</em>"));

// assert
cut.MarkupMatches("<em>loading</em>");
}
}