package com.atlassian.stash.internal.web.soy.functions;

import com.atlassian.soy.renderer.JsExpression;
import org.junit.Test;

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.*;

public class PathNameFunctionTest {

    private PathNameFunction function = new PathNameFunction();

    @Test
    public void testAcceptOneValue() throws Exception {
        assertThat(function.validArgSizes(), containsInAnyOrder(1));
    }

    @Test
    public void testGenerateJsExpressionForSimpleVariable() throws Exception {
        JsExpression jsExpression = function.generate(new JsExpression("variable"));
        assertEquals("new (require('bitbucket/internal/model/path'))(variable).getName()", jsExpression.getText());
    }

}