javascript——我已经为case switch编写了测试用例,但我无法涵盖代码中的中断

jecbmhm3  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(181)

这是我必须测试的代码:

getTransitionMethod(transition) {
        switch (transition) {
            // ease linear
            case "easeLinear":
                return d3EaseLinear;
                break;
            // easeQuadIn as d3EaseQuadIn,
            case "easeQuadIn":
                return d3EaseQuadIn;
                break;
            // easeQuadOut as d3EaseQuadOut
            case "easeQuadOut":
                return d3EaseQuadOut;
                break;
            // easeQuadInOut as d3EaseQuadInOut
            case "easeQuadInOut":
                return d3EaseQuadInOut;
                break;
            // easeCubicIn as d3EaseCubicIn
            case "easeCubicIn":
                return d3EaseCubicIn;
                break;
            // easeCubicOut as d3EaseCubicOut,
            case "easeCubicOut":
                return d3EaseCubicOut;
                break;
            // easeCubicInOut as d3EaseCubicInOut,
            case "easeCubicInOut":
                return d3EaseCubicInOut;
                break;
            // easePolyIn as d3EasePolyIn,
            case "easePolyIn":
                return d3EasePolyIn;
                break;

这是针对每种情况进行的快照测试:

describe("<ReactSpeedometer caseswitch 1/>", () => {
    const setup = () => {
        const majorProps = {
            needleTransition: "easeLinear",

        };
        const wrapper1 = mount(<ReactSpeedometer {...majorProps} />);
        return { majorProps,wrapper1};
    };
    describe("basic snapshot testing", () => {
        const { wrapper1, majorProps } = setup();
        it("should render correctly", () => {
            expect(toJson(wrapper1)).toMatchSnapshot();
        });
    });
});

根据这份报道,我无法报道这段休息时间,有人能帮我吗?我如何在报道中报道这段休息时间?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题