33using PrompterOne . Shared . Components . Editor ;
44using PrompterOne . Shared . Contracts ;
55using PrompterOne . Shared . Tests ;
6+ using PrompterOne . Testing . Editor ;
67
78namespace PrompterOne . Web . Tests ;
89
910public sealed class EditorMetadataRailTests : BunitContext
1011{
11- private const string SplitActionLabel = "Open in Library" ;
12- private const string SplitFeedbackBadge = "From ##" ;
13- private const string SplitFeedbackDestination = "New scripts were saved to the library." ;
14- private const string SplitFeedbackDraftNote = "The current draft stayed open." ;
15- private const string SplitFeedbackSummary = "2 new scripts created." ;
16- private const string SplitFeedbackTitle = "Split complete" ;
1712 private const string SplitHint = "Create separate scripts from headings in the current draft." ;
1813 private const string SplitSection = "Split Into New Scripts" ;
1914 private const string SplitTopLevelLabel = "New scripts from # headings" ;
20- private const string SplitSegmentLabel = "New scripts from ## headings" ;
21- private const string CreatedEpisodeOne = "Episode 1 - How to Think About Systems" ;
22- private const string CreatedEpisodeTwo = "Episode 2 - How Systems Talk to Each Other" ;
23- private const string CreatedEpisodeThree = "Episode 3 - Event Sourcing and CQRS" ;
2415
2516 public EditorMetadataRailTests ( )
2617 {
@@ -44,7 +35,7 @@ public void EditorMetadataRail_SplitActionsInvokeExpectedModes_AndRenderSplitFee
4435 Assert . Contains ( SplitSection , cut . Markup , StringComparison . Ordinal ) ;
4536 Assert . Equal ( SplitHint , cut . Find ( $ ".ed-meta-action-note") . TextContent . Trim ( ) ) ;
4637 Assert . Equal ( SplitTopLevelLabel , cut . FindByTestId ( UiTestIds . Editor . SplitTopLevel ) . TextContent . Trim ( ) ) ;
47- Assert . Equal ( SplitSegmentLabel , cut . FindByTestId ( UiTestIds . Editor . SplitSegment ) . TextContent . Trim ( ) ) ;
38+ Assert . Equal ( EditorSplitFeedbackTestData . SplitSegmentActionLabel , cut . FindByTestId ( UiTestIds . Editor . SplitSegment ) . TextContent . Trim ( ) ) ;
4839
4940 cut . FindByTestId ( UiTestIds . Editor . SplitTopLevel ) . Click ( ) ;
5041 cut . FindByTestId ( UiTestIds . Editor . SplitSegment ) . Click ( ) ;
@@ -54,31 +45,26 @@ public void EditorMetadataRail_SplitActionsInvokeExpectedModes_AndRenderSplitFee
5445 [ TpsDocumentSplitMode . TopLevelHeading , TpsDocumentSplitMode . SegmentHeading ] ,
5546 requestedModes ) ;
5647 Assert . Equal ( 1 , openLibraryRequests ) ;
57- Assert . Equal ( SplitFeedbackTitle , cut . FindByTestId ( UiTestIds . Editor . SplitResultTitle ) . TextContent . Trim ( ) ) ;
58- Assert . Equal ( SplitFeedbackSummary , cut . FindByTestId ( UiTestIds . Editor . SplitResultSummary ) . TextContent . Trim ( ) ) ;
59- Assert . Equal ( SplitFeedbackBadge , cut . FindByTestId ( UiTestIds . Editor . SplitResultBadge ) . TextContent . Trim ( ) ) ;
60- Assert . Equal ( SplitFeedbackDestination , cut . FindByTestId ( UiTestIds . Editor . SplitResultLibrary ) . TextContent . Trim ( ) ) ;
61- Assert . Equal ( SplitFeedbackDraftNote , cut . FindByTestId ( UiTestIds . Editor . SplitResultCurrentDraft ) . TextContent . Trim ( ) ) ;
62- Assert . Equal ( CreatedEpisodeOne , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 0 ) ) . TextContent . Trim ( ) . Replace ( "01" , string . Empty ) . Trim ( ) ) ;
63- Assert . Equal ( CreatedEpisodeTwo , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 1 ) ) . TextContent . Trim ( ) . Replace ( "02" , string . Empty ) . Trim ( ) ) ;
64- Assert . Equal ( CreatedEpisodeThree , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 2 ) ) . TextContent . Trim ( ) . Replace ( "03" , string . Empty ) . Trim ( ) ) ;
48+ Assert . Equal ( EditorSplitFeedbackTestData . SplitFeedbackTitle , cut . FindByTestId ( UiTestIds . Editor . SplitResultTitle ) . TextContent . Trim ( ) ) ;
49+ Assert . Equal ( EditorSplitFeedbackTestData . SplitFeedbackSummary , cut . FindByTestId ( UiTestIds . Editor . SplitResultSummary ) . TextContent . Trim ( ) ) ;
50+ Assert . Equal ( EditorSplitFeedbackTestData . SplitFeedbackBadge , cut . FindByTestId ( UiTestIds . Editor . SplitResultBadge ) . TextContent . Trim ( ) ) ;
51+ Assert . Equal ( EditorSplitFeedbackTestData . SplitFeedbackDestination , cut . FindByTestId ( UiTestIds . Editor . SplitResultLibrary ) . TextContent . Trim ( ) ) ;
52+ Assert . Equal ( EditorSplitFeedbackTestData . SplitFeedbackDraftNote , cut . FindByTestId ( UiTestIds . Editor . SplitResultCurrentDraft ) . TextContent . Trim ( ) ) ;
53+ Assert . Equal ( EditorSplitFeedbackTestData . EpisodeOneTitle , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 0 ) ) . TextContent . Trim ( ) . Replace ( "01" , string . Empty ) . Trim ( ) ) ;
54+ Assert . Equal ( EditorSplitFeedbackTestData . EpisodeTwoTitle , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 1 ) ) . TextContent . Trim ( ) . Replace ( "02" , string . Empty ) . Trim ( ) ) ;
55+ Assert . Equal ( EditorSplitFeedbackTestData . EpisodeThreeTitle , cut . FindByTestId ( UiTestIds . Editor . SplitResultItem ( 2 ) ) . TextContent . Trim ( ) . Replace ( "03" , string . Empty ) . Trim ( ) ) ;
6556 Assert . Equal ( "+2 more in Library" , cut . FindByTestId ( UiTestIds . Editor . SplitResultMore ) . TextContent . Trim ( ) ) ;
66- Assert . Equal ( SplitActionLabel , cut . FindByTestId ( UiTestIds . Editor . SplitResultOpenLibrary ) . TextContent . Trim ( ) ) ;
57+ Assert . Equal ( EditorSplitFeedbackTestData . SplitActionLabel , cut . FindByTestId ( UiTestIds . Editor . SplitResultOpenLibrary ) . TextContent . Trim ( ) ) ;
6758 }
6859
6960 private static EditorSplitFeedbackViewModel BuildSplitFeedback ( ) =>
7061 new (
71- Title : SplitFeedbackTitle ,
72- Summary : SplitFeedbackSummary ,
73- HeadingBadge : SplitFeedbackBadge ,
74- DestinationNote : SplitFeedbackDestination ,
75- DraftNote : SplitFeedbackDraftNote ,
76- OpenLibraryLabel : SplitActionLabel ,
77- CreatedTitles :
78- [
79- CreatedEpisodeOne ,
80- CreatedEpisodeTwo ,
81- CreatedEpisodeThree
82- ] ,
83- AdditionalCount : 2 ) ;
62+ Title : EditorSplitFeedbackTestData . SplitFeedbackTitle ,
63+ Summary : EditorSplitFeedbackTestData . SplitFeedbackSummary ,
64+ HeadingBadge : EditorSplitFeedbackTestData . SplitFeedbackBadge ,
65+ DestinationNote : EditorSplitFeedbackTestData . SplitFeedbackDestination ,
66+ DraftNote : EditorSplitFeedbackTestData . SplitFeedbackDraftNote ,
67+ OpenLibraryLabel : EditorSplitFeedbackTestData . SplitActionLabel ,
68+ CreatedTitles : EditorSplitFeedbackTestData . MetadataRailCreatedTitles ,
69+ AdditionalCount : EditorSplitFeedbackTestData . MetadataRailAdditionalCount ) ;
8470}
0 commit comments