blob: 078c8e17c4ae498ec2f37c38af4bcd391068c679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import React from "react";
import { mount } from "enzyme";
import { OnboardingVideo } from "content-src/components/OnboardingVideo";
describe("OnboardingVideo component", () => {
let sandbox;
beforeEach(async () => {
sandbox = sinon.createSandbox();
});
afterEach(() => {
sandbox.restore();
});
const SCREEN_PROPS = {
content: {
title: "Test title",
video_container: {
video_url: "test url",
},
},
};
it("should handle video_start action when video is played", () => {
const handleAction = sandbox.stub();
const wrapper = mount(
<OnboardingVideo handleAction={handleAction} {...SCREEN_PROPS} />
);
wrapper.find("video").simulate("play");
assert.calledWith(handleAction, {
currentTarget: { value: "video_start" },
});
});
it("should handle video_end action when video has completed playing", () => {
const handleAction = sandbox.stub();
const wrapper = mount(
<OnboardingVideo handleAction={handleAction} {...SCREEN_PROPS} />
);
wrapper.find("video").simulate("ended");
assert.calledWith(handleAction, {
currentTarget: { value: "video_end" },
});
});
});
|