-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from Atralupus/feat/item-slot-query
Implement item slot query
- Loading branch information
Showing
6 changed files
with
169 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Mimir.Tests/QueryTests/ItemSlotTest.GraphQL_Query_ItemSlot_Returns_CorrectValue.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"data": { | ||
"itemSlot": { | ||
"battleType": "ADVENTURE", | ||
"costumes": [ | ||
"00000000-0000-0000-0000-000000000000" | ||
], | ||
"equipments": [ | ||
"00000000-0000-0000-0000-000000000000" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Lib9c.Models.States; | ||
using Libplanet.Crypto; | ||
using Mimir.MongoDB.Bson; | ||
using Mimir.MongoDB.Repositories; | ||
using Moq; | ||
|
||
namespace Mimir.Tests.QueryTests; | ||
|
||
public class ItemSlotTest | ||
{ | ||
[Fact] | ||
public async Task GraphQL_Query_ItemSlot_Returns_CorrectValue() | ||
{ | ||
var address = new Address("0x0000000001000000000200000000030000000004"); | ||
var state = new ItemSlotState | ||
{ | ||
BattleType = Nekoyume.Model.EnumType.BattleType.Adventure, | ||
Costumes = new List<Guid> { default }, | ||
Equipments = new List<Guid> { default } | ||
}; | ||
var mockRepo = new Mock<IItemSlotRepository>(); | ||
mockRepo | ||
.Setup(repo => | ||
repo.GetByAddressAsync( | ||
It.IsAny<Address>(), | ||
Nekoyume.Model.EnumType.BattleType.Adventure | ||
) | ||
) | ||
.ReturnsAsync(new ItemSlotDocument(1, address, state)); | ||
var serviceProvider = TestServices.Builder.With(mockRepo.Object).Build(); | ||
var query = $$""" | ||
query { | ||
itemSlot(address: "{{address}}", battleType: ADVENTURE) { | ||
battleType, | ||
costumes, | ||
equipments | ||
} | ||
} | ||
"""; | ||
|
||
var result = await TestServices.ExecuteRequestAsync( | ||
serviceProvider, | ||
b => b.SetDocument(query) | ||
); | ||
|
||
await Verify(result); | ||
} | ||
} |
Oops, something went wrong.