You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 23:16:19 +00:00
feat(items): reindex returns sanitized furnidata delta
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
package com.eu.habbo.habbohotel.items;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class FurnitureTextProviderDeltaTest {
|
||||
|
||||
@Test
|
||||
void firstReindexReturnsAllAsDelta() {
|
||||
FurnitureTextProvider p = new FurnitureTextProvider(true);
|
||||
List<FurnidataEntry> delta = p.reindex(List.of(
|
||||
new FurnidataEntry(1, "chair", FurnitureType.FLOOR, "Chair", "Sit")));
|
||||
assertEquals(1, delta.size());
|
||||
assertEquals("Chair", delta.get(0).name());
|
||||
}
|
||||
|
||||
@Test
|
||||
void unchangedReindexReturnsEmptyDelta() {
|
||||
FurnitureTextProvider p = new FurnitureTextProvider(true);
|
||||
List<FurnidataEntry> first = List.of(new FurnidataEntry(1, "chair", FurnitureType.FLOOR, "Chair", "Sit"));
|
||||
p.reindex(first);
|
||||
List<FurnidataEntry> delta = p.reindex(first);
|
||||
assertTrue(delta.isEmpty(), "no change => empty delta");
|
||||
}
|
||||
|
||||
@Test
|
||||
void changedNameAppearsInDeltaWithSanitizedValue() {
|
||||
FurnitureTextProvider p = new FurnitureTextProvider(true);
|
||||
p.reindex(List.of(new FurnidataEntry(1, "chair", FurnitureType.FLOOR, "Chair", "Sit")));
|
||||
List<FurnidataEntry> delta = p.reindex(List.of(
|
||||
new FurnidataEntry(1, "chair", FurnitureType.FLOOR, "New %x%", "Sit")));
|
||||
assertEquals(1, delta.size());
|
||||
assertFalse(delta.get(0).name().contains("%"), "delta carries the sanitized name");
|
||||
assertEquals(1, delta.get(0).id());
|
||||
assertEquals(FurnitureType.FLOOR, delta.get(0).type());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user