@@ -8,6 +8,7 @@ import { describe, expect, it } from "vite-plus/test";
88
99import type { SettingsTarget } from "./settings-environment-filter" ;
1010import {
11+ planMobileAutoSettleScopePatch ,
1112 planMobileScopedSettingsClear ,
1213 planMobileScopedSettingsPatch ,
1314 resolveMobileSettingsTargets ,
@@ -116,6 +117,73 @@ describe("mobile project settings scope", () => {
116117 } ,
117118 ) ;
118119
120+ it ( "keeps each environment's duration when changing the inactivity scope" , ( ) => {
121+ const targets = resolveMobileSettingsTargets (
122+ [
123+ environment ( firstId , { ...DEFAULT_SERVER_SETTINGS , sidebarAutoSettleAfterDays : 30 } , true ) ,
124+ environment (
125+ secondId ,
126+ { ...DEFAULT_SERVER_SETTINGS , sidebarAutoSettleAfterDays : null } ,
127+ true ,
128+ ) ,
129+ ] ,
130+ null ,
131+ ) ;
132+ expect ( planMobileAutoSettleScopePatch ( targets , false , "without-pr" , 3 ) ) . toEqual ( [
133+ { environmentId : firstId , patch : { sidebarAutoSettleScope : "without-pr" } } ,
134+ {
135+ environmentId : secondId ,
136+ patch : { sidebarAutoSettleScope : "without-pr" , sidebarAutoSettleAfterDays : 3 } ,
137+ } ,
138+ ] ) ;
139+ } ) ;
140+
141+ it ( "keeps each project override's duration when changing the inactivity scope" , ( ) => {
142+ const targets = resolveMobileSettingsTargets (
143+ [
144+ environment (
145+ firstId ,
146+ {
147+ ...DEFAULT_SERVER_SETTINGS ,
148+ projectSettingsOverrides : { [ firstProject ] : { sidebarAutoSettleAfterDays : 14 } } ,
149+ } ,
150+ true ,
151+ ) ,
152+ environment (
153+ secondId ,
154+ {
155+ ...DEFAULT_SERVER_SETTINGS ,
156+ sidebarAutoSettleAfterDays : 7 ,
157+ projectSettingsOverrides : { [ secondProject ] : { sidebarAutoSettleAfterDays : null } } ,
158+ } ,
159+ true ,
160+ ) ,
161+ ] ,
162+ [
163+ { environmentId : firstId , id : firstProject } ,
164+ { environmentId : secondId , id : secondProject } ,
165+ ] ,
166+ ) ;
167+ expect ( planMobileAutoSettleScopePatch ( targets , true , "all" , 3 ) ) . toEqual ( [
168+ {
169+ environmentId : firstId ,
170+ patch : {
171+ projectSettingsOverrides : {
172+ [ firstProject ] : { sidebarAutoSettleAfterDays : 14 , sidebarAutoSettleScope : "all" } ,
173+ } ,
174+ } ,
175+ } ,
176+ {
177+ environmentId : secondId ,
178+ patch : {
179+ projectSettingsOverrides : {
180+ [ secondProject ] : { sidebarAutoSettleAfterDays : 3 , sidebarAutoSettleScope : "all" } ,
181+ } ,
182+ } ,
183+ } ,
184+ ] ) ;
185+ } ) ;
186+
119187 it ( "edits each checkout's own override without changing either environment default" , ( ) => {
120188 const firstSettings : ServerSettings = {
121189 ...DEFAULT_SERVER_SETTINGS ,
0 commit comments