package sg.selfservice.bigbait.kitchen;

public final class KitchenUrlTest {
    public static void main(String[] args) {
        String[] allowed = {KitchenUrl.START, KitchenUrl.START + "#pending", "https://admin.self-service.sg:443/bigbait/kitchen.php?store=2"};
        String[] blocked = {null, "", "http://admin.self-service.sg/bigbait/kitchen.php?store=2",
                "https://admin.self-service.sg.evil.test/bigbait/kitchen.php?store=2",
                "https://user@admin.self-service.sg/bigbait/kitchen.php?store=2",
                "https://admin.self-service.sg:8443/bigbait/kitchen.php?store=2",
                "https://admin.self-service.sg/bigbait/kitchen.php?store=3",
                KitchenUrl.START + "&store=3", KitchenUrl.START + "&action=orders",
                "https://admin.self-service.sg/bigbait/employee_login.php",
                "javascript:alert(1)", "file:///etc/passwd", "intent://example", KitchenUrl.EXIT};
        for (String value : allowed) if (!KitchenUrl.isKitchenPage(value)) throw new AssertionError("Rejected kitchen page: " + value);
        for (String value : blocked) if (KitchenUrl.isKitchenPage(value)) throw new AssertionError("Allowed unexpected page: " + value);
        System.out.println("PASS: Store 2 navigation policy (" + (allowed.length + blocked.length) + " cases)");
    }
}
