Skip to content
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

Edge cases for deriving the singular data class name from table names that are plural #2700

Conversation

bascoe10
Copy link
Contributor

Complete todo with covering edge cases in deriving the singular data class name from a plural table name

Copy link
Owner

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍 The changes look good to me, but it would be nice to have tests for them. Tests like these could be expanded to verify the table.nameOfRowClass for these cases:

test('use overridden name', () async {
final result = await findTable('TableWithCustomName');
final table = result!.result as DriftTable;
expect(result.errorsDuringAnalysis, isEmpty);
expect(table.schemaName, 'my-fancy-table');
expect(table.withoutRowId, isTrue);
});

@bascoe10
Copy link
Contributor Author

I agree. I will add some test cases.

@simolus3
Copy link
Owner

Let me know if you need any help with the tests cases :)

@bascoe10
Copy link
Contributor Author

Let me know if you need any help with the tests cases :)

I got caught up with some other things. I have updated my PR with some test cases.

@bascoe10 bascoe10 requested a review from simolus3 November 17, 2023 03:36
Copy link
Owner

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tests! Let's avoid the duplicate, but apart from that this looks good.

drift_dev/test/analysis/resolver/dart/table_test.dart Outdated Show resolved Hide resolved
@simolus3 simolus3 merged commit 3fb9e50 into simolus3:develop Nov 22, 2023
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants