chore(ava): fix most test cases bug - #840
Conversation
Summary of ChangesHello @Yzing, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses and rectifies several issues within the data feature extraction and type analysis mechanisms of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request includes several useful fixes and refactorings, particularly in the test suite and DataStore implementation. The configuration changes for Jest and TypeScript are also positive improvements. However, I've identified two instances in __tests__/unit/extract/feature/index.test.ts where test expectations appear to have been updated to align with incorrect logic, potentially masking underlying bugs in data type analysis. My comments provide more detail on these specific cases.
| const info = analyzeField(array) as StringColumnFeature; | ||
| expect(info.recommendation).toBe('string'); | ||
| expect(info.recommendation).toBe('null'); | ||
| expect(info.distinct).toBe(1); |
There was a problem hiding this comment.
The expectation for distinct is incorrect here. For an array containing only null or nil values, the number of distinct values should be 0. The test now expects 1. This change seems to accommodate a bug in a utility function when it receives an empty array, which causes it to report one distinct value (undefined).
This test should assert that distinct is 0. The underlying issue in the utility function should be addressed separately.
| expect(info.distinct).toBe(1); | |
| expect(info.distinct).toBe(0); |
| expect(isInterval(analyzeField([1.1, 2]))).toBe(true); | ||
| expect(isNominal(analyzeField(['是', '否']))).toBe(true); | ||
| expect(isDiscrete(analyzeField([1, 2, 3, 4, 5, 6, 7]))).toBe(true); | ||
| expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(false); |
There was a problem hiding this comment.
This test expectation seems incorrect. The array [1, 0, 1, 0, 1, 0, 1] should be classified as boolean by analyzeField because it has only two distinct values (0 and 1), which is a special case for boolean types. The isNominal function returns true for fields with a boolean recommendation. Therefore, this test should expect true.
| expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(false); | |
| expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(true); |
PR includes