@@ -188,6 +188,54 @@ def load_file(file)
188188 expect ( Fastlane ::Helper ::GitHubActionsHelper ) . to have_received ( :set_output ) . with ( "release_branch_name" , release_branch_name )
189189 end
190190
191+ it "prepares the release branch with version updates for macOS and returns update_embedded_warning" do
192+ platform = "macos"
193+ version = "1.0.0"
194+ release_branch_name = "release/#{ platform } /#{ version } "
195+ other_action = double ( "other_action" )
196+ options = { some_option : "value" }
197+ github_token = "github-token"
198+ update_embedded_warning = true
199+
200+ @client = double ( "Octokit::Client" )
201+ allow ( Octokit ::Client ) . to receive ( :new ) . and_return ( @client )
202+ allow ( @client ) . to receive ( :latest_release ) . and_return ( double ( tag_name : version ) )
203+ allow ( Fastlane ::Helper ) . to receive ( :is_ci? ) . and_return ( false )
204+ allow ( Fastlane ::Helper ::GitHelper ) . to receive ( :repo_name ) . and_return ( "macOS" )
205+
206+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :code_freeze_prechecks )
207+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :validate_new_version )
208+ . with ( version ) . and_return ( version )
209+
210+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :create_release_branch )
211+ . with ( platform , version ) . and_return ( release_branch_name )
212+
213+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :update_embedded_files )
214+ . with ( platform , other_action ) . and_return ( update_embedded_warning )
215+
216+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :update_version_config )
217+ . with ( version , other_action )
218+
219+ allow ( Fastlane ::Helper ::GitHubActionsHelper ) . to receive ( :set_output )
220+
221+ expect ( other_action ) . to receive ( :push_to_git_remote )
222+
223+ result_branch , result_version , result_warning = Fastlane ::Helper ::DdgAppleAutomationHelper . prepare_release_branch (
224+ platform , version , other_action
225+ )
226+
227+ expect ( result_branch ) . to eq ( release_branch_name )
228+ expect ( result_version ) . to eq ( version )
229+ expect ( result_warning ) . to eq ( update_embedded_warning )
230+
231+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :code_freeze_prechecks )
232+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :validate_new_version ) . with ( version )
233+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :create_release_branch ) . with ( platform , version )
234+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_embedded_files ) . with ( platform , other_action )
235+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_version_config ) . with ( version , other_action )
236+ expect ( Fastlane ::Helper ::GitHubActionsHelper ) . to have_received ( :set_output ) . with ( "release_branch_name" , release_branch_name )
237+ end
238+
191239 it "prepares the release branch with version updates for iOS" do
192240 platform = "ios"
193241 version = "1.0.0"
@@ -237,6 +285,58 @@ def load_file(file)
237285 expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_root_plist_version ) . with ( version , other_action )
238286 expect ( Fastlane ::Helper ::GitHubActionsHelper ) . to have_received ( :set_output ) . with ( "release_branch_name" , release_branch_name )
239287 end
288+
289+ it "prepares the release branch with version updates for iOS and returns update_embedded_warning" do
290+ platform = "ios"
291+ version = "1.0.0"
292+ release_branch_name = "release/#{ platform } /#{ version } "
293+ other_action = double ( "other_action" )
294+ options = { some_option : "value" }
295+ github_token = "github-token"
296+ update_embedded_warning = true
297+
298+ @client = double ( "Octokit::Client" )
299+ allow ( Octokit ::Client ) . to receive ( :new ) . and_return ( @client )
300+ allow ( @client ) . to receive ( :latest_release ) . and_return ( double ( tag_name : version ) )
301+ allow ( Fastlane ::Helper ) . to receive ( :is_ci? ) . and_return ( false )
302+ allow ( Fastlane ::Helper ::GitHelper ) . to receive ( :repo_name ) . and_return ( "iOS" )
303+
304+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :code_freeze_prechecks )
305+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :validate_new_version )
306+ . with ( version ) . and_return ( version )
307+
308+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :create_release_branch )
309+ . with ( platform , version ) . and_return ( release_branch_name )
310+
311+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :update_embedded_files )
312+ . with ( platform , other_action ) . and_return ( update_embedded_warning )
313+
314+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :update_version_and_build_number_config )
315+ . with ( version , 0 , other_action )
316+
317+ allow ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to receive ( :update_root_plist_version )
318+ . with ( version , other_action )
319+
320+ allow ( Fastlane ::Helper ::GitHubActionsHelper ) . to receive ( :set_output )
321+
322+ expect ( other_action ) . to receive ( :push_to_git_remote )
323+
324+ result_branch , result_version , result_warning = Fastlane ::Helper ::DdgAppleAutomationHelper . prepare_release_branch (
325+ platform , version , other_action
326+ )
327+
328+ expect ( result_branch ) . to eq ( "release/ios/1.0.0" )
329+ expect ( result_version ) . to eq ( version )
330+ expect ( result_warning ) . to eq ( update_embedded_warning )
331+
332+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :code_freeze_prechecks )
333+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :validate_new_version ) . with ( version )
334+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :create_release_branch ) . with ( platform , version )
335+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_embedded_files ) . with ( platform , other_action )
336+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_version_and_build_number_config ) . with ( version , 0 , other_action )
337+ expect ( Fastlane ::Helper ::DdgAppleAutomationHelper ) . to have_received ( :update_root_plist_version ) . with ( version , other_action )
338+ expect ( Fastlane ::Helper ::GitHubActionsHelper ) . to have_received ( :set_output ) . with ( "release_branch_name" , release_branch_name )
339+ end
240340 end
241341
242342 describe "#create_hotfix_branch" do
@@ -417,6 +517,40 @@ def load_file(file)
417517 expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "add" , "Core/trackerData.json" )
418518 expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "commit" , "-m" , "Update embedded files" )
419519 end
520+
521+ it "returns true when TDS performance tests fail" do
522+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "./scripts/update_embedded.sh" ) . and_return ( "" )
523+ git_status_output = "On branch main\n modified: Core/trackerData.json\n "
524+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "status" ) . and_return ( git_status_output )
525+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "add" , "Core/trackerData.json" ) . and_return ( "" )
526+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "commit" , "-m" , "Update embedded files" ) . and_return ( "" )
527+ allow ( other_action ) . to receive ( :tds_perf_test ) . and_return ( false )
528+ allow ( other_action ) . to receive ( :ensure_git_status_clean )
529+
530+ result = described_class . update_embedded_files ( platform , other_action )
531+
532+ expect ( result ) . to eq ( true )
533+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "status" )
534+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "add" , "Core/trackerData.json" )
535+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "commit" , "-m" , "Update embedded files" )
536+ end
537+
538+ it "returns false when TDS performance tests pass" do
539+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "./scripts/update_embedded.sh" ) . and_return ( "" )
540+ git_status_output = "On branch main\n modified: Core/trackerData.json\n "
541+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "status" ) . and_return ( git_status_output )
542+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "add" , "Core/trackerData.json" ) . and_return ( "" )
543+ allow ( Fastlane ::Actions ) . to receive ( :sh ) . with ( "git" , "commit" , "-m" , "Update embedded files" ) . and_return ( "" )
544+ allow ( other_action ) . to receive ( :tds_perf_test ) . and_return ( true )
545+ allow ( other_action ) . to receive ( :ensure_git_status_clean )
546+
547+ result = described_class . update_embedded_files ( platform , other_action )
548+
549+ expect ( result ) . to eq ( false )
550+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "status" )
551+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "add" , "Core/trackerData.json" )
552+ expect ( Fastlane ::Actions ) . to have_received ( :sh ) . with ( "git" , "commit" , "-m" , "Update embedded files" )
553+ end
420554 end
421555
422556 describe "#increment_build_number" do
0 commit comments