From 08ae4c0a58bc0a313ebe73c0272d264168bef8b8 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 10 Dec 2017 14:47:37 -0800 Subject: [PATCH] Fix failing tests --- js/components/MainWindow/Marquee.test.js | 12 -- .../PlaylistWindow/PlaylistShade.test.js | 4 + .../__snapshots__/PlaylistShade.test.js.snap | 138 +++++++++++++++++- 3 files changed, 141 insertions(+), 13 deletions(-) diff --git a/js/components/MainWindow/Marquee.test.js b/js/components/MainWindow/Marquee.test.js index 26ed8724..61711a14 100644 --- a/js/components/MainWindow/Marquee.test.js +++ b/js/components/MainWindow/Marquee.test.js @@ -3,7 +3,6 @@ import { getBalanceText, getVolumeText, getPositionText, - getMediaText, getDoubleSizeModeText, stepOffset, pixelUnits, @@ -55,17 +54,6 @@ describe("getPositionText", () => { }); }); -describe("getMediaText", () => { - it("formats a name and duration", () => { - const trackNumber = 1; - const name = "My Great Song"; - const duration = 86; - const actual = getMediaText(trackNumber, name, duration); - const expected = "1. My Great Song (01:26) *** "; - expect(actual).toEqual(expected); - }); -}); - describe("stepOffset", () => { const long = "This is a long string. Longer than 30 characters!"; it("starts at 0", () => { diff --git a/js/components/PlaylistWindow/PlaylistShade.test.js b/js/components/PlaylistWindow/PlaylistShade.test.js index 51ef8f46..62ac53ac 100644 --- a/js/components/PlaylistWindow/PlaylistShade.test.js +++ b/js/components/PlaylistWindow/PlaylistShade.test.js @@ -1,5 +1,6 @@ const media = { addEventListener: jest.fn(), + loadFromUrl: jest.fn(), _analyser: null }; @@ -9,6 +10,7 @@ import React from "react"; import { Provider } from "react-redux"; import renderer from "react-test-renderer"; import getStore from "../../store"; +import { loadMediaFromUrl } from "../../actionCreators"; import PlaylistShade from "./PlaylistShade"; @@ -19,6 +21,8 @@ describe("PlaylistShade", () => { }); it("renders to snapshot", () => { + store.dispatch(loadMediaFromUrl("http://example.com", "Some Name", false)); + console.log(store.getState().playlist.tracks[0]); const tree = renderer .create( diff --git a/js/components/PlaylistWindow/__snapshots__/PlaylistShade.test.js.snap b/js/components/PlaylistWindow/__snapshots__/PlaylistShade.test.js.snap index 628342ab..f2354c40 100644 --- a/js/components/PlaylistWindow/__snapshots__/PlaylistShade.test.js.snap +++ b/js/components/PlaylistWindow/__snapshots__/PlaylistShade.test.js.snap @@ -19,7 +19,143 @@ exports[`PlaylistShade renders to snapshot 1`] = ` >
+ > +
+ 1 +
+
+ . +
+
+ +
+
+ S +
+
+ o +
+
+ m +
+
+ e +
+
+ +
+
+ N +
+
+ a +
+
+ m +
+
+ e +
+
+ +
+
+ ( +
+
+ 0 +
+
+ 0 +
+
+ : +
+
+ 0 +
+
+ 0 +
+
+ ) +
+
+ +
+
+ +
+
+ * +
+
+ * +
+
+ * +
+
+ +
+
+ +
+