Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 2bf763a

Browse files
committed
Add test for Karui fragment, cleanup code and unused property
1 parent 74f1c8c commit 2bf763a

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

src/Sidekick.Business/Apis/Poe/Parser/ItemSections.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public ItemSections(string[][] splitSections, string[] wholeSections)
2525

2626
public string MapPropertiesSection => WholeSections[1];
2727

28-
public string MapInfluenceSection => WholeSections[3];
29-
3028
public string NameLine => HeaderSection.Length > 1 ? HeaderSection[1] : string.Empty;
3129

3230
public string TypeLine => HeaderSection.Length > 2 ? HeaderSection[2] : string.Empty;

src/Sidekick.Business/Apis/Poe/Parser/ParserService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private void ParseGem(Item item, ItemSections itemSections)
191191

192192
private bool ParseFromEnd(Regex pattern, ItemSections itemSections)
193193
{
194-
if (itemSections.WholeSections.Count() < 3)
194+
if (itemSections.WholeSections.Length < 3)
195195
return false;
196196

197197
// Section order at the end:

tests/Sidekick.Business.Tests/ItemParserTests/MapParsing.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using FluentAssertions.Execution;
55
using NUnit.Framework;
66
using Sidekick.Business.Apis.Poe.Parser;
7+
using Sidekick.Business.Apis.Poe.Trade.Data.Items;
78

89
namespace Sidekick.Business.Tests.ItemParserTests
910
{
@@ -90,6 +91,18 @@ public async Task ParseOccupiedMap()
9091
}
9192
}
9293

94+
[Test]
95+
public async Task ParseTimelessKaruiEmblem()
96+
{
97+
var actual = await Subject.ParseItem(TimelessKaruiEmblem);
98+
99+
using (new AssertionScope())
100+
{
101+
actual.Type.Should().Be("Timeless Karui Emblem");
102+
actual.Category.Should().Be(Category.Map);
103+
}
104+
}
105+
93106
#region ItemText
94107

95108
private const string NormalMap = @"Rarity: Normal
@@ -185,6 +198,11 @@ Players gain 50% reduced Flask Charges
185198
--------
186199
Travel to this Map by using it in a personal Map Device. Maps can only be used once.";
187200

201+
private const string TimelessKaruiEmblem = @"Rarity: Normal
202+
Timeless Karui Emblem
203+
--------
204+
Place two or more different Emblems in a Map Device to access the Domain of Timeless Conflict. Can only be used once.";
205+
188206
#endregion
189207
}
190208
}

tests/Sidekick.Business.Tests/ItemParserTests/MiscParsing.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using NUnit.Framework;
55
using Sidekick.Business.Apis.Poe.Models;
66
using Sidekick.Business.Apis.Poe.Parser;
7+
using Sidekick.Business.Apis.Poe.Trade.Data.Items;
78

89
namespace Sidekick.Business.Tests.ItemParserTests
910
{
@@ -66,7 +67,7 @@ public async Task ParseOrgan()
6667
using (new AssertionScope())
6768
{
6869
actual.Rarity.Should().Be(Rarity.Unique);
69-
actual.Category.Should().Be(Apis.Poe.Trade.Data.Items.Category.ItemisedMonster);
70+
actual.Category.Should().Be(Category.ItemisedMonster);
7071
actual.Type.Should().Be("Portentia, the Foul");
7172
}
7273
}

0 commit comments

Comments
 (0)