Skip to content

Don't check for address 2 presence in in person flow if the test value is nil#6575

Merged
jmhooper merged 3 commits intomainfrom
jmhooper-squash-warning
Jul 12, 2022
Merged

Don't check for address 2 presence in in person flow if the test value is nil#6575
jmhooper merged 3 commits intomainfrom
jmhooper-squash-warning

Conversation

@jmhooper
Copy link
Contributor

Don't check for address 2 precense in in person flow if the test value is nil

Currently this test renders this warning:

Checking for expected text of nil is confusing and/or pointless since it will always match. Please specify a string or regexp instead. /builds/lg/identity-idp/spec/features/idv/in_person_spec.rb:61

...and it does have a point. This commit adds a conditional which only runs the check if address 2 is present. Alternatively we could just remove that line entirely.

jmhooper added 2 commits July 11, 2022 15:03
…e is nil

Currently this test renders this warning:

```
Checking for expected text of nil is confusing and/or pointless since it will always match. Please specify a string or regexp instead. /builds/lg/identity-idp/spec/features/idv/in_person_spec.rb:61
```

...and it does have a point. This commit adds a conditional which only runs the check if address 2 is present. Alternatively we could just remove that line entirely.
@jmhooper jmhooper changed the title Jmhooper squash warning Don't check for address 2 presence in in person flow if the test value is nil Jul 11, 2022
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Saw this last week as well. I think condition makes sense in case we want to specify a real value later on.

👍

expect(page).to have_text(InPersonHelper::GOOD_STATE_ID_NUMBER)
expect(page).to have_text(InPersonHelper::GOOD_ADDRESS1)
expect(page).to have_text(InPersonHelper::GOOD_ADDRESS2)
expect(page).to have_text(InPersonHelper::GOOD_ADDRESS2) if InPersonHelper::GOOD_ADDRESS2
Copy link
Contributor

Choose a reason for hiding this comment

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

I expect constants to be ... constant? like we should know if the value exists or not ahead of time? Like we would just remove this line or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there's some indirection because this constant is ultimately derived from some other constants. But I am happy to just yank it; that makes sense too.

@jmhooper
Copy link
Contributor Author

@aduth: I just switched it up to get rid of the constant, since like Zach said, we should know that it's nil if it is a constant. And I don't know if there's too much risk of trouble if it ever does assume a value.

@jmhooper
Copy link
Contributor Author

And if we're concerned about not rendering address line 2 we should probably have a unit test around that

@jmhooper jmhooper merged commit 94edfbb into main Jul 12, 2022
@jmhooper jmhooper deleted the jmhooper-squash-warning branch July 12, 2022 14:52
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