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

TypeScript brookjs-desalinate.chaiPlugin函数代码示例

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

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



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

示例1: chaiPlugin

/* eslint-env mocha */
import { expect, use } from 'chai';
import { chaiPlugin } from 'brookjs-desalinate';
import Kefir from 'kefir';
import ofType from '../ofType';

const { plugin, send, value, stream } = chaiPlugin({ Kefir });
use(plugin);

describe('ofType', () => {
  it('should match when passing one type', () => {
    const action$ = stream();

    expect(action$.thru(ofType('MATCHED'))).to.emit(
      [value({ type: 'MATCHED' })],
      () => {
        send(action$, [
          value({ type: 'UNMATCHED' }),
          value({ type: 'MATCHED' })
        ]);
      }
    );
  });

  it('should match when passing one type with Function#toString', () => {
    const matched = () => ({ type: 'MATCHED' });
    matched.toString = () => 'MATCHED';
    const action$ = stream();

    expect(action$.thru(ofType(matched))).to.emit(
      [value({ type: 'MATCHED' })],
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:31,代码来源:ofType.spec.ts


示例2: chaiPlugin

/* eslint-env mocha */
import { expect, use } from 'chai';
import { chaiPlugin } from 'brookjs-desalinate';
import Kefir from 'kefir';
import chaiJestSnapshot from 'chai-jest-snapshot';
import sinon from 'sinon';
import { selectWebpackConfig } from '../selectors';
import { State } from '../types';

const { plugin } = chaiPlugin({ Kefir });
use(plugin);
use(chaiJestSnapshot);

describe('BuildCommand#selectors', () => {
  describe('selectWebpackConfig', () => {
    it('should call the modifier when creating webpack config', () => {
      const config = {};
      const modifier = sinon.stub().returns(config);
      const state: State = {
        building: true,
        watch: false,
        env: 'production',
        results: null,
        cwd: '/path/to/cwd',
        rc: {
          webpack: {
            modifier
          } as any
        }
      };
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:30,代码来源:selectors.spec.ts


示例3: chaiPlugin

/* eslint-env mocha */
import { applyMiddleware, createStore } from 'redux';
import chai, { expect } from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import Kefir from 'kefir';
import configureStore from 'redux-mock-store';
import { chaiPlugin } from 'brookjs-desalinate';
import ofType from '../ofType';
import { observeDelta } from '../observeDelta';

chai.use(sinonChai);
const { plugin, value } = chaiPlugin({ Kefir });
chai.use(plugin);

describe('observeDelta', function() {
  let delta,
    delta$,
    deltaMiddlware,
    reducer,
    initial,
    store,
    actions$,
    state$,
    sub;

  beforeEach(function() {
    delta = sinon.spy(function() {
      return (delta$ = Kefir.pool());
    });
    deltaMiddlware = observeDelta(delta);
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:31,代码来源:observeDelta.spec.ts


示例4: chaiPlugin

/* eslint-env mocha */
// @flow
import { expect, use } from 'chai';
import Kefir from 'kefir';
import { chaiPlugin } from 'brookjs-desalinate';
import view from '../view';

const { plugin, stream, prop, value, send, error, end } = chaiPlugin({ Kefir });
use(plugin);

describe('view', () => {
  it('should be a function', () => {
    expect(view).to.be.a('function');
  });

  it('should take a callback and return a function', () => {
    expect(view(x => x)).to.be.a('function');
  });

  it('should be able to be passed to Observable#thru', () => {
    expect(stream().thru(view(x => x))).to.be.an.observable.stream();
    expect(prop().thru(view(x => x))).to.be.an.observable.property();
  });

  it('should emit result from function callback', () => {
    const a = stream();

    expect(a.thru(view(x => !x))).to.emit([value(true)], () => {
      send(a, [value(false)]);
    });
  });
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:31,代码来源:view.spec.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript browser-bunyan.createLogger函数代码示例发布时间:2022-05-25
下一篇:
TypeScript brolog.log类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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