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

Refactor DateTime and Duration tests to use chain.assertOK #346

Closed
gavv opened this issue Mar 23, 2023 · 3 comments
Closed

Refactor DateTime and Duration tests to use chain.assertOK #346

gavv opened this issue Mar 23, 2023 · 3 comments
Assignees
Labels
good first issue Good for newcomers help wanted Contributions are welcome refactoring Refactoring task tests Improvements or additions to tests
Milestone

Comments

@gavv
Copy link
Owner

gavv commented Mar 23, 2023

DateTime and Duration have many fragments like this:

			if tc.expectInRange {
				NewDateTime(reporter, tc.value).
					InRange(tc.min, tc.max).
					chain.assertNotFailed(t)
			} else {
				NewDateTime(reporter, tc.value).
					InRange(tc.min, tc.max).
					chain.assertFailed(t)
			}
			if tc.expectNotInRange {
				NewDateTime(reporter, tc.value).
					NotInRange(tc.min, tc.max).
					chain.assertNotFailed(t)
			} else {
				NewDateTime(reporter, tc.value).
					NotInRange(tc.min, tc.max).
					chain.assertFailed(t)
			}

With recently added chain.assertOK, such fragments can be simplified to:

			NewDateTime(reporter, tc.value).InRange(tc.min, tc.max).
				chain.assertOK(t, tc.expectInRange)

			NewDateTime(reporter, tc.value).NotInRange(tc.min, tc.max).
				chain.assertOK(t, tc.expectNotInRange)

This should be done in all appropriate tests in datetime_test.go and duration_test.go.

Similar to #345

@gavv gavv added tests Improvements or additions to tests help wanted Contributions are welcome refactoring Refactoring task good first issue Good for newcomers labels Mar 23, 2023
@Darrellbor
Copy link
Contributor

@gavv I'd like to work on this

@gavv
Copy link
Owner Author

gavv commented Mar 23, 2023

Do you ever sleep? :) You're welcome!

@Darrellbor
Copy link
Contributor

@gavv 😂 I do, I've been trying to get my golang prowess to the level of my javascript/typescript
plus coding is somewhat soothing for me 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions are welcome refactoring Refactoring task tests Improvements or additions to tests
Projects
None yet
Development

No branches or pull requests

2 participants