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

Add modifyOutput function to TestFormula. #378

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

Laimiux
Copy link
Collaborator

@Laimiux Laimiux commented Aug 22, 2024

What

To simplify modifying a single property of the output, I'm adding modifyOutput function to TestFormula

val formula = TestFormula(initialOutput = Value(a, b))
formula.modifyOutput { copy(a = newA) }

import com.instacart.formula.test.SimpleFormula.Input
import com.instacart.formula.test.SimpleFormula.Output

interface SimpleFormula : IFormula<Input, Output> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rewriting the tests using a much simpler formula.

observer.output(on)
}

class ParentFormula(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replacing all of this with a simpler test formula

}
}

@Test fun `input passed to formula`() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not needed

@Laimiux Laimiux force-pushed the laimonas/test-formula-modify-output branch from 63b1f70 to 9177e6a Compare August 22, 2024 12:11
@carrotkite
Copy link

JaCoCo Code Coverage 87.89% ✅

Class Covered Meta Status
com/instacart/formula/test/TestFormula 87% 0%

Generated by 🚫 Danger

Copy link

@jasonostrander jasonostrander left a comment

Choose a reason for hiding this comment

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

I like this!

@Laimiux Laimiux merged commit fde5066 into master Aug 22, 2024
4 checks passed
@Laimiux Laimiux deleted the laimonas/test-formula-modify-output branch August 22, 2024 17:15
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.

3 participants