-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[code-infra] Remove clock=fake from describeValidation
#17150
Conversation
describeValidation
Deploy preview: https://deploy-preview-17150--material-ui-x.netlify.app/ |
@@ -154,7 +154,7 @@ const createSection = ({ | |||
} else { | |||
if (sectionConfig.maxLength == null) { | |||
throw new Error( | |||
`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`, | |||
`MUI X: The token ${token} should have a 'maxLength' property on it's adapter`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text seemed wrong, as I couldn't find a maxDigitNumber
prop
setValue(past); | ||
describe('with fake timers', () => { | ||
// TODO: temporary for vitest. Can move to `vi.useFakeTimers` | ||
let timer: SinonFakeTimers | null = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake timer here
value: [past, now], | ||
describe('with fake timers', () => { | ||
// TODO: temporary for vitest. Can move to `vi.useFakeTimers` | ||
let timer: SinonFakeTimers | null = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake timer here
} | ||
describeSkipIf(!withDate)('with fake timers', () => { | ||
// TODO: temporary for vitest. Can move to `vi.useFakeTimers` | ||
let timer: SinonFakeTimers | null = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake timer here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice optimization. 👍
Thanks for shrinking the vite mega PR. 🙏 💯
These are improvements made during the
vitest
PRI'm moving the changes out so that PR is leaner.
The main change here is removing the fake date usage from most of the
describeValidation
logic.I've left it only where necessary, in the
should apply disablePast
testsAn alternative would be to always fake the date, which would probably work, but I preferred a more precise approach.