-
Notifications
You must be signed in to change notification settings - Fork 2
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
Trade index #395
Trade index #395
Conversation
Code Climate has analyzed commit 85e1ab1 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (90% is the threshold). This pull request will bring the total coverage in the repository to 91.2% (0.1% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a good start! just needs some adjusting :)
$response = $this->get(route('trade.index', [ | ||
'requested_items' => $trades->first()->requested_items, | ||
'description' => $trades->first()->description, | ||
'item_name' => $trades->first()->items->first()->name, | ||
'item_description' => $trades->first()->items->first()->description, | ||
'item_rarity' => $trades->first()->items->first()->rarity, | ||
])); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there aren't any assertions in this test, would you be able to add some that check the trade items are there? Or maybe that the count of items returned in the trade the expected amount of items based off the applied filters?
$trades = Trade::factory(3) | ||
->has(Item::factory(3)) | ||
->create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isnt the state a trade would be in; basically a trade will post an item
and have offers in the items
relation (note the s) so you'd need to define the specific relationships your assigning the items too, you can find how that works here in the docs, note the second code block where they specify the relationship name
Co-authored-by: Massimo <[email protected]>
Co-authored-by: Massimo <[email protected]>
Co-authored-by: Massimo <[email protected]>
Co-authored-by: Massimo <[email protected]>
Co-authored-by: Massimo <[email protected]>
…sion-tome into 376-trade-index
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty excellent to me!
fn (Assert $page) => $page | ||
->where('id', $trades->first()->id) | ||
->where('item_id', $trades->first()->item_id) | ||
->where('character_id', $trades->first()->character_id) | ||
->where('requested_items', $trades->first()->requested_items) | ||
->where('description', $trades->first()->description) | ||
->where('status', $trades->first()->status) | ||
->etc() | ||
->has( | ||
'item', | ||
fn (Assert $page) => $page | ||
->where('id', $trades->first()->item->id) | ||
->where('entry_id', $trades->first()->item->entry_id) | ||
->where('character_id', $trades->first()->item->character_id) | ||
->where('name', $trades->first()->item->name) | ||
->where('author_id', $trades->first()->item->author_id) | ||
->where('rarity', $trades->first()->item->rarity) | ||
->where('tier', $trades->first()->item->tier) | ||
->where('description', $trades->first()->item->description) | ||
->etc() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, nice, this is really proper testing with inertia responses; good work!
Description
Filtered trades by requested_items, description, item name, item description, or item rarity.
Closes #376