@@ -33,7 +33,7 @@ import * as React from 'react';
3333import { describe , it , expect , vi , afterEach } from 'vitest' ;
3434import { render , screen , fireEvent , cleanup , within } from '@testing-library/react' ;
3535import { I18nProvider , createI18n } from '@object-ui/i18n' ;
36- import { ObjectSchema } from '@objectstack/spec/data' ;
36+ import { ValidationRuleSchema } from '@objectstack/spec/data' ;
3737
3838import { ObjectValidationsPanel } from './ObjectValidationsPanel' ;
3939import { t } from '../metadata-admin/i18n' ;
@@ -130,7 +130,8 @@ describe('a new field rule waits for its field and message (objectstack#26731)',
130130 events : [ 'insert' , 'update' ] ,
131131 } ) ;
132132 expect ( written [ 1 ] . field ) . not . toBe ( 'created_at' ) ;
133- expect ( ObjectSchema . safeParse ( { ...baseDraft , validations : written } ) . success ) . toBe ( true ) ;
133+ // The rule the pillar would save parses through the spec's own rule schema.
134+ expect ( ValidationRuleSchema . safeParse ( written [ 1 ] ) . success ) . toBe ( true ) ;
134135
135136 // Written, it is an ordinary rule.
136137 expect ( screen . queryByTestId ( 'rule-unsaved' ) ) . toBeNull ( ) ;
@@ -200,7 +201,7 @@ describe('an empty transition row is not stored (objectstack#26731)', () => {
200201 expect ( onPatch ) . toHaveBeenCalledTimes ( 1 ) ;
201202 const written = lastValidations ( onPatch ) [ 0 ] ;
202203 expect ( written . transitions ) . toEqual ( { open : [ 'closed' ] , closed : [ 'open' ] } ) ;
203- expect ( written . transitions ) . not . toHaveProperty ( '' ) ;
204+ expect ( Object . keys ( written . transitions as object ) ) . not . toContain ( '' ) ;
204205 // The row it became is the one the author is typing in.
205206 expect ( screen . getAllByPlaceholderText ( t ( 'engine.studio.rules.transitionFrom' , 'en-US' ) ) [ 1 ] ) . toHaveValue ( 'closed' ) ;
206207 } ) ;
0 commit comments