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

TypeScript expect类代码示例

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

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



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

示例1: it

    it('should throw if passed invalid store shape', () => {
      let result = false;

      Reflect.deleteProperty(store, 'dispatch');

      try {
        getAsyncInjectors(store);
      } catch (err) {
        result = err.name === 'Invariant Violation';
      }

      expect(result).toEqual(true);
    });
开发者ID:StrikeForceZero,项目名称:react-boilerplate,代码行数:13,代码来源:asyncInjectors.test.ts


示例2: it

		it('does not append trailing separator when directory', function (done) {
			var file = new File({
				path: '/test/foo',
				stat: {
					isDirectory: function () {
						return true;
					},
				} as any as fs.Stats,
			});

			expect(file.basename).toEqual('foo');
			done();
		});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:13,代码来源:vinyl-tests.ts


示例3: it

  it('resets the points of players', () => {
    const initialState = new State()
      .setIn(['players', 1], new Player({
        points: 10,
      }));

    const state = reducer(initialState, {
      type: 'startMatch',
      endTime: 123,
    });

    expect(state.players.get(1).points).toEqual(0);
  });
开发者ID:thomasboyt,项目名称:manygolf,代码行数:13,代码来源:reducer.spec.ts


示例4: it

  it('should override old image when ATTACH_IMAGE', () => {
    const imageLink = 'http://whatever';
    const newerImageLink = 'http://igiveashit';
    const nodeId = this.leaf.data.id;

    const action = graphManipulationActions.attachImageToNode(imageLink, this.leaf);
    const newState = graphReducer(this.mockState, action);
    const nextAction = graphManipulationActions.attachImageToNode(newerImageLink, this.leaf);
    const newerState = graphReducer(newState, nextAction);

    const nodeWithImage = findNode(newerState.raw, nodeId).node;
    expect(nodeWithImage.image).toEqual(newerImageLink);
  });
开发者ID:TienSFU25,项目名称:graphical-memories,代码行数:13,代码来源:graphReducer.test.ts


示例5: expect

      Render.into(document.body, init, () => {
        const [span, div, text] = Array.from(document.body.childNodes)

        expect((span as HTMLElement).tagName).toBe('SPAN')
        expect((div as HTMLElement).tagName).toBe('DIV')
        expect(text).toExist()
        expect(text.textContent).toBe('some text')

        const updated = [
          h('span'),
          h('input'),
          'some text (2)'
        ]

        // Update 1: Swap the middle element
        Render.into(init, updated, () => {
          const [updatedSpan, input, updatedText] = Array.from(document.body.childNodes)

          expect(updatedSpan).toBe(span)
          expect((input as HTMLElement).tagName).toBe('INPUT')
          expect(updatedText).toBe(text)
          expect(updatedText.textContent).toBe('some text (2)')

          const emptyNodes: VNode[] = []

          // Update 2: Empty array
          Render.into(updated, emptyNodes, () => {
            expect(document.body.children.length).toBe(0)

            // Update 3: Go back to the second VNode structure
            Render.into(emptyNodes, updated, () => {
              expect(document.body.childNodes.length).toBe(3)
              done()
            })
          })

        })
      })
开发者ID:AlexGalays,项目名称:kaiju,代码行数:38,代码来源:render.ts


示例6: it

 it('should render 2-level template with children and props', () => {
   expect(render({
     tagName: 'div',
     children: {
       tagName: 'div',
       children: 'Hello',
       props: {
         'data-title': 'Greeting',
       },
     },
   })).toBe(
     '<div><div data-title="Greeting">Hello</div></div>'
   );
 });
开发者ID:1ven,项目名称:json-parser,代码行数:14,代码来源:squirrel.spec.ts


示例7: it

		it('copies history', function (done) {
			var options = {
				cwd: '/',
				base: '/test/',
				path: '/test/test.coffee',
				contents: null,
			};
			var history = [
				path.normalize('/test/test.coffee'),
				path.normalize('/test/test.js'),
				path.normalize('/test/test-938di2s.js'),
			];

			var file = new File(options);
			file.path = history[1];
			file.path = history[2];
			var file2 = file.clone();

			expect(file2.history).toEqual(history);
			expect(file2.history).toNotBe(file.history);
			expect(file2.path).toEqual(history[2]);
			done();
		});
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:23,代码来源:vinyl-tests.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript express类代码示例发布时间:2022-05-28
下一篇:
TypeScript execa类代码示例发布时间: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