diff --git a/src/elements/public/StoreForm/StoreForm.test.ts b/src/elements/public/StoreForm/StoreForm.test.ts index cb009be08..9677d08e2 100644 --- a/src/elements/public/StoreForm/StoreForm.test.ts +++ b/src/elements/public/StoreForm/StoreForm.test.ts @@ -2469,4 +2469,61 @@ describe('StoreForm', () => { expect(element.errors).to.include('error:store_domain_exists'); }); + it('produces the auto-anonymize-days:v8n_too_small error when the value is under 90', () => { + const form = new Form(); + expect(form.errors).to.not.include('auto-anonymize-days:v8n_too_small'); + + form.edit({ data_retention: { auto_anonymize: false, auto_anonymize_days: 89 } }); + expect(form.errors).to.include('auto-anonymize-days:v8n_too_small'); + + form.edit({ data_retention: { auto_anonymize: false, auto_anonymize_days: 90 } }); + expect(form.errors).to.not.include('auto-anonymize-days:v8n_too_small'); + }); + + it('produces the auto-anonymize-days:v8n_required error when auto-anonymization is on but days are unset', () => { + const form = new Form(); + expect(form.errors).to.not.include('auto-anonymize-days:v8n_required'); + + form.edit({ data_retention: { auto_anonymize: true, auto_anonymize_days: null } }); + expect(form.errors).to.include('auto-anonymize-days:v8n_required'); + + form.edit({ data_retention: { auto_anonymize: true, auto_anonymize_days: 365 } }); + expect(form.errors).to.not.include('auto-anonymize-days:v8n_required'); + }); + + it('renders a switch control for auto-anonymization in the Data Retention section', async () => { + const element = await fixture