package io.wealthwizards.appsynctesting.utils;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;

@DisplayName("$util.map")
public class MapTest {
    @Test
    @DisplayName(".copyAndRetainAllKeys")
    public void shouldImplementCopyAndRetainAllKeys() {
        var map = new Map();

        var original = java.util.Map.of(
                "hello", "world",
                "another", "value",
                "additional", 123L
        );

        var toKeep = List.of("hello", "additional");

        var actual = map.copyAndRetainAllKeys(original, toKeep);

        var expected = java.util.Map.of(
                "hello", "world",
                "additional", 123L
        );

        assertEquals(expected, actual);
    }

    @Test
    @DisplayName(".copyAndRemoveAllKeys")
    public void shouldImplementCopyAndRemoveAllKeys() {
        var map = new Map();

        var original = java.util.Map.of(
                "hello", "world",
                "another", "value",
                "additional", 123L
        );

        var toRemove = List.of("hello", "additional");

        var actual = map.copyAndRemoveAllKeys(original, toRemove);

        var expected = java.util.Map.of(
                "another", "value"
        );

        assertEquals(expected, actual);
    }
}
