• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript testing.it函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/testing.it函数的典型用法代码示例。如果您正苦于以下问题:TypeScript it函数的具体用法?TypeScript it怎么用?TypeScript it使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了it函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: describe

describe('MapPipe', () => {
    
    let pipe: SomePipe;
    
    const fn = function (item) {
        return item === 2;
    };
    
    beforeEach(() => {
       pipe = new SomePipe(); 
    });
    
    it('Should return true', () => {
       
       const array = [0, 1, 2, 3];
       
       expect(pipe.transform(array, fn)).toEqual(true); 
       expect(array).toEqual([0, 1, 2, 3]); // Check integrity
    });
    
    it('Should return false', () => {
       
       expect(pipe.transform([1,3], fn)).toEqual(false); 
    });
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform('a', null)).toEqual('a'); 
    });
    
})
开发者ID:josx,项目名称:angular-pipes,代码行数:31,代码来源:some.pipe.spec.ts


示例2: describe

describe('TailPipe', () => {
    
    let pipe: TailPipe;
    
    beforeEach(() => {
       pipe = new TailPipe(); 
    });
    
    it('Should return []', () => {
       
       expect(pipe.transform([])).toEqual([]); 
    });
    
    it('Should return [2]', () => {
       
       expect(pipe.transform([1, 2])).toEqual([2]); 
    });
    
    it ('Should return [2, 3]', () => {
       
       expect(pipe.transform([1, 2, 3])).toEqual([2, 3]); 
    });
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform('a')).toEqual('a'); 
    });
    
});
开发者ID:josx,项目名称:angular-pipes,代码行数:29,代码来源:tail.pipe.spec.ts


示例3: describe

describe('CapitalizePipe', () => {
    
    let pipe: CapitalizePipe;
    
    beforeEach(() => {
       pipe = new CapitalizePipe(); 
    });
    
    it('Should returned the capitalized string', () => {
       
       expect(pipe.transform('abcd', false)).toEqual('Abcd');
    });
    
    it('Should returned the capitalized string #2', () => {
       
       expect(pipe.transform('abcd aa', false)).toEqual('Abcd aa');
    });
    
    it('Should returned the capitalized string #3', () => {
       
       expect(pipe.transform('abCD aA', false)).toEqual('Abcd aa');
    });
    
    it('Should returned the capitalized string #4', () => {
       
       expect(pipe.transform('abCD aA', true)).toEqual('Abcd Aa');
    });
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform(1, null)).toEqual(1); 
    });
   
});
开发者ID:josx,项目名称:angular-pipes,代码行数:34,代码来源:capitalize.pipe.spec.ts


示例4: describe

describe('FloorPipe', () => {
    
    let pipe: FloorPipe;
    
    beforeEach(() => {
       pipe = new FloorPipe(); 
    });
    
    it('Should return 3', () => {
        
        expect(pipe.transform(3.4, 0)).toEqual(3);
    });
    
    it('Should return 1', () => {
        
        expect(pipe.transform(1, 0)).toEqual(1);
    });
    
    it('Should return 0', () => {
        
        expect(pipe.transform(0.65, 0)).toEqual(0);
    });
    
    it('Should return 1.5', () => {
       
       expect(pipe.transform(1.5, 1)).toEqual(1.5); 
    });
    
    
    it('Should return 1.54', () => {
       
       expect(pipe.transform(1.5444, 2)).toEqual(1.54); 
    });
});
开发者ID:josx,项目名称:angular-pipes,代码行数:34,代码来源:floor.pipe.spec.ts


示例5: describe

describe('TestPipe', () => {
    
    let pipe: TestPipe;
    
    beforeEach(() => {
       pipe = new TestPipe(); 
    });
    
    
    it('Should return true', () => {
       
        const result = pipe.transform('abc', /a/g);
        expect(result).toEqual(true);
    });
    
    it('Should return false', () => {
       
        const result = pipe.transform('abc', /d/g);
        expect(result).toEqual(false);
    });
    
    
    // Just use test function ...
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform(1, null, null)).toEqual(1); 
    });
   
});
开发者ID:josx,项目名称:angular-pipes,代码行数:30,代码来源:test.pipe.spec.ts


示例6: describe

describe('IsObjectPipe', () => {
    
    let pipe: IsObjectPipe;
    
    beforeEach(() => {
       pipe = new IsObjectPipe(); 
    });
    
    it('Should return true', () => {
        
        expect(pipe.transform({})).toEqual(true);
    });
    
    it('Should return false', () => {
        
        expect(pipe.transform(1)).toEqual(false);
    });
    
    it('Should return true #2', () => {
        
        expect(pipe.transform([])).toEqual(true);
    });
    
    it('Should return false #3', () => {
        
        expect(pipe.transform('a')).toEqual(false);
    });
});
开发者ID:josx,项目名称:angular-pipes,代码行数:28,代码来源:types.pipe.spec.ts


示例7: describe

describe('JoinPipe ', () => {
    
    let pipe: JoinPipe;
    
    beforeEach(() => {
       pipe = new JoinPipe (); 
    });
    
    it('Should return "abcd"', () => {
       
       expect(pipe.transform(['a', 'b', 'c', 'd'], '')).toEqual('abcd'); 
    });
    
    it('Should return abc123', () => {
       
       expect(pipe.transform(['a', 'b', 'c', 1, 2, 3], '')).toEqual('abc123'); 
    });
    
    it ('Should return 1a2a3', () => {
       
       expect(pipe.transform([1, 2, 3], 'a')).toEqual('1a2a3'); 
    });
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform('a', '')).toEqual('a'); 
    });
    
});
开发者ID:josx,项目名称:angular-pipes,代码行数:29,代码来源:join.pipe.spec.ts


示例8: describe

describe('RangePipe', () => {
    
    let pipe: RangePipe;
    
    beforeEach(() => {
       pipe = new RangePipe(); 
    });
    
    it('Should return a range from 1 to 10', () => {
       
       expect(pipe.transform([], 10, 1)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); 
    });
    
    it('Should return a range from 0 to 4', () => {
       
       expect(pipe.transform([], 5, 0)).toEqual([0, 1, 2, 3, 4]); 
    });
    
    it('Should return a range from -2 to +2', () => {
       
       expect(pipe.transform([], 5, -2)).toEqual([-2, -1, 0, 1, 2]); 
    });
    
    
    it ('Should return a range from 0 to 18 with a step of 2', () => {
       
       expect(pipe.transform([], 10, 0, 2)).toEqual([0, 2, 4, 6, 8, 10, 12, 14, 16, 18]);
    });
})
开发者ID:josx,项目名称:angular-pipes,代码行数:29,代码来源:range.pipe.spec.ts


示例9: describe

describe('TakePipe', () => {
    
    let pipe: TakePipe;
    
    beforeEach(() => {
       pipe = new TakePipe(); 
    });
    
    it('Should return []', () => {
       
       expect(pipe.transform([])).toEqual([]); 
    });
    
    it('Should return [1]', () => {
       
       const value = [1, 2, 3, 4];
       
       expect(pipe.transform(value)).toEqual([1]); 
       expect(value).toEqual([1, 2, 3, 4]); // Check integrity
    });
    
    it ('Should return [1, 2]', () => {
       
       expect(pipe.transform([1, 2, 3, 4], 2)).toEqual([1, 2]); 
    });
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform('a')).toEqual('a'); 
    });
    
})
开发者ID:josx,项目名称:angular-pipes,代码行数:32,代码来源:take.pipe.spec.ts


示例10: describe

describe('CountPipe', () => {
    
    let pipe: CountPipe;
    
    beforeEach(() => {
       pipe = new CountPipe(); 
    });
    
    it('Should return the length of the collection', () => {
       
       expect(pipe.transform([1,2])).toEqual(2); 
    });
    
    it('Should return the length of the object (keys)', () => {
       
       expect(pipe.transform({ a: 1, b: 2, c: 3})).toEqual(3); 
    });
    
  
    
    it('Should return the value unchanged', () => {
       
       expect(pipe.transform('a')).toEqual('a'); 
    });
    
});
开发者ID:josx,项目名称:angular-pipes,代码行数:26,代码来源:count.pipe.spec.ts



注:本文中的@angular/testing.it函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript testing.TestComponentBuilder类代码示例发布时间:2022-05-28
下一篇:
TypeScript testing.inject函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap