码迷,mamicode.com
首页 > 其他好文 > 详细

[Unit test] jasmine createSpyObj

时间:2019-12-12 21:12:13      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:span   post   jasmine   enc   creates   sch   each   div   tran   

    beforeEach(() => {
      contextStub = {
        debug: false,
        engine: jasmine.createSpyObj(‘engine‘, [
          ‘createCollection‘, ‘createContext‘, ‘createSchematic‘,
          ‘createSourceFromUrl‘, ‘transformOptions‘, ‘executePostTasks‘
        ]),
        logger: jasmine.createSpyObj(‘logger‘, [‘info‘]),
        schematic: jasmine.createSpyObj(‘schematic‘, [‘call‘]),
        strategy: 0,
        interactive: false,
        addTask: jasmine.createSpy()
      };
    });

    it(‘schedules an npm install task if Material is not installed‘, () => {
      const rule = installMaterial();
      rule(testTree, contextStub);

      expect(contextStub.addTask).toHaveBeenCalled();
      expect(contextStub.logger.info).toHaveBeenCalledWith(‘Installing Angular Material...‘);
    });

 

[Unit test] jasmine createSpyObj

标签:span   post   jasmine   enc   creates   sch   each   div   tran   

原文地址:https://www.cnblogs.com/Answer1215/p/12031590.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!