Ejemplo n.º 1
0
        public void should_export_no_jt_if_line_is_comment()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\comment-spec.js");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(0, utInfos.Count);
        }
Ejemplo n.º 2
0
        public void should_export_jt_with_irregular_indent()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\irregular-indent-spec.js");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(1, utInfos.Count);

            UTInfo utInfo = utInfos.Single();

            Assert.Equal(1, utInfo.ThenList.Count);
        }
Ejemplo n.º 3
0
        public void should_export_describe_and_it_with_single_quotes()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\single-quotes-spec.js");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(1, utInfos.Count);

            UTInfo utInfo = utInfos.Single();

            Assert.Equal("describe", utInfo.Description);
            Assert.Equal("it 1", utInfo.ThenList[0].Description);
            Assert.Equal("it 2", utInfo.ThenList[1].Description);
        }
Ejemplo n.º 4
0
        public void should_export_2_utInfos()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\two-describe-in-same-level.js");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(2, utInfos.Count);

            UTInfo utInfo1 = utInfos.First();

            Assert.Equal("describe 1", utInfo1.Description);
            Assert.Equal("it 1.1", utInfo1.ThenList[0].Description);
            Assert.Equal("it 1.2", utInfo1.ThenList[1].Description);

            UTInfo utInfo2 = utInfos.Last();

            Assert.Equal("describe 2", utInfo2.Description);
            Assert.Equal("it 2.1", utInfo2.ThenList[0].Description);
            Assert.Equal("it 2.2", utInfo2.ThenList[1].Description);
        }
Ejemplo n.º 5
0
        public void should_export_jt_with_nested_jts()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\nested-spec.es6");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(2, utInfos.Count);

            UTInfo topUtInfo1 = utInfos.First();

            Assert.Equal("top describe 1", topUtInfo1.Description);
            Assert.Equal("top it 1.1", topUtInfo1.ThenList[0].Description);
            Assert.Equal("top it 1.2", topUtInfo1.ThenList[1].Description);

            UTInfo child1 = topUtInfo1.Children.First();

            Assert.Equal("describe 1", child1.Description);
            Assert.Equal("it 1.1", child1.ThenList[0].Description);
            Assert.Equal("it 1.2", child1.ThenList[1].Description);

            Assert.Equal(1, child1.Children.Count);
            UTInfo grandson = child1.Children.First();

            Assert.Equal("describe 1.3", grandson.Description);
            Assert.Equal("it 1.3.1", grandson.ThenList[0].Description);
            Assert.Equal("it 1.3.2", grandson.ThenList[1].Description);

            UTInfo child2 = topUtInfo1.Children.Last();

            Assert.Equal("describe 2", child2.Description);
            Assert.Equal("it 2.1", child2.ThenList[0].Description);
            Assert.Equal("it 2.2", child2.ThenList[1].Description);

            UTInfo topUtInfo2 = utInfos.Last();

            Assert.Equal("top describe 2", topUtInfo2.Description);
            Assert.Equal("top it 2.1", topUtInfo2.ThenList[0].Description);
            Assert.Equal("top it 2.2", topUtInfo2.ThenList[1].Description);
        }
        public void should_export_jt_with_correct_levels()
        {
            var fixtureFileFullName = TestUtils.GetFixtureFileFullName("JT\\Fixtures\\space-and-tab-spec.es6");

            var           jtManager = new JTManager();
            List <UTInfo> utInfos   = jtManager.Export(fixtureFileFullName);

            Assert.Equal(1, utInfos.Count);

            UTInfo topUtInfo = utInfos.Single();

            Assert.Equal(1, topUtInfo.Children.Count);

            UTInfo child = topUtInfo.Children.Single();

            Assert.Equal("describe with 3 spaces and 1 tab", child.Description);
            Assert.Equal(1, child.Children.Count);

            UTInfo grandson = child.Children.Single();

            Assert.Equal("describe with 5 spaces and 1 tab", grandson.Description);
        }