它是什么意思"不应影响其他功能"

时间:2018-06-11 10:53:09

标签: jasmine

describe("A spy, when faking a return value", function() {
    var foo, bar, fetchedBar;
    beforeEach(function() {
        foo = {
            setBar: function(value) {
                bar = value;
            },
            getBar: function() {
                return bar;
            }
        };
        spyOn(foo, 'getBar').andReturn(745);
        foo.setBar(123);
        fetchedBar = foo.getBar();
    });
    it("tracks that the spy was called", function() {
        expect(foo.getBar).toHaveBeenCalled();
    });
    it("should not effect other functions", function() {
        expect(bar).toEqual(123);
    });
    it("when called returns the requested value", function() {
        expect(fetchedBar).toEqual(745);
    });
});

当我阅读Jasmine间谍介绍时,我遇到了这个标题为"不应影响其他功能的规范" ,我不明白。

我知道酒吧应该等于123,但标题让我困惑。

0 个答案:

没有答案