當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript expect類代碼示例

本文整理匯總了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;未經允許,請勿轉載。