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


TypeScript ts-mockito.anything函數代碼示例

本文整理匯總了TypeScript中ts-mockito.anything函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript anything函數的具體用法?TypeScript anything怎麽用?TypeScript anything使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了anything函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('returns a promise with the resolved layout', async () => {
   when(mockedNativeCommandsSender.setRoot(anything(), anything())).thenResolve(
     'the resolved layout'
   );
   const result = await uut.setRoot({ root: { component: { name: 'com.example.MyScreen' } } });
   expect(result).toEqual('the resolved layout');
 });
開發者ID:wix,項目名稱:react-native-navigation,代碼行數:7,代碼來源:Commands.test.ts

示例2: it

	it('should update just once', () => {
		component.draw({}, id, {});
		component.draw({}, id, {});
		component.remove(id);
		component.draw({}, id, {});
		verify(simpleDrawerService.update(anything(), anything())).once();
	});
開發者ID:CHBaker,項目名稱:angular-cesium,代碼行數:7,代碼來源:basic-desc.service.spec.ts

示例3: it

    it('calls findMatchingFiles with given arguments', () => {
      const app = new BaseApp();
      const spiedContext = spy(Context);

      when(spiedContext.findMatchingFiles(anything(), anything())).thenReturn([]);

      app.addDirectory('src/**/*.js', {
        isGlob: true,
        globOptions: {
          gitignore: true,
        },
      });

      const lastCall = capture(spiedContext.findMatchingFiles).last();
      lastCall.must.eql([
        'src/**/*.js',
        {
          isGlob: true,
          globOptions: {
            gitignore: true,
          },
        },
      ]);

      reset(spiedContext);
    });
開發者ID:yruan,項目名稱:inceptum,代碼行數:26,代碼來源:BaseApp.ts

示例4: describe

describe('CesiumService', () => {
	let mapContainer;
	const defaultZooms = 1;
	const viewerFactory = mock(ViewerFactory);
	const element = document.createElement("div");
	const defaultTilt = true;
	const mode3D = Cesium.SceneMode.SCENE3D;
	const mode2D = Cesium.SceneMode.SCENE2D;
	const modeColumbus = Cesium.SceneMode.COLUMBUS_VIEW;

	when(viewerFactory.createViewer(anything(),anything())).thenReturn({
		scene: {
			screenSpaceCameraController: {
				minimumZoomDistance: defaultZooms,
				maximumZoomDistance: defaultZooms,
				enableTilt: defaultTilt
			},
			mode: mode3D,
			morphTo2D: function () {
				this.mode = mode2D;
			},
			morphToColumbusView: function () {
				this.mode = modeColumbus;
			},
			morphTo3D: function () {
				this.mode = mode3D;
			}
		}
	});

	beforeEach(() => {
		mapContainer = document.createElement('mapContainer');
		document.body.appendChild(mapContainer);

		TestBed.configureTestingModule({
			providers: [CesiumService, providerFromMock(ViewerFactory, viewerFactory)]
		});
	});

	beforeEach(inject([CesiumService], (service: CesiumService) => {
		service.init(mapContainer);
	}));

	afterEach(() => {
		mapContainer.remove();
	});

	it('should create', inject([CesiumService], (service: CesiumService) => {
		expect(service).toBeDefined();
	}));

	it('should initialize and return viewer', inject([CesiumService], (service: CesiumService) => {
		expect(service.getViewer()).toBeDefined();
	}));

	it('should return scene', inject([CesiumService], (service: CesiumService) => {
		expect(service.getScene()).toBeDefined();
	}));
});
開發者ID:CHBaker,項目名稱:angular-cesium,代碼行數:59,代碼來源:cesium.service.spec.ts

示例5: test

 test('Readonly flag is passed (true)', async () => {
   const check = new MySQLHealthCheck('testCheck', true);
   const mockedMysqlClient = mock(MySQLClient);
   when(mockedMysqlClient.ping(anything())).thenReturn(Promise.resolve(undefined));
   check.mysqlClient = instance(mockedMysqlClient);
   await check.doCheck();
   verify(mockedMysqlClient.ping(true)).once();
 });
開發者ID:yruan,項目名稱:inceptum,代碼行數:8,代碼來源:MySQLHealthCheck.ts


注:本文中的ts-mockito.anything函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。