Skip to content

Commit

Permalink
chore(tests): remove eslint exceptions
Browse files Browse the repository at this point in the history
After changing the tests to not use the 'this' keyword
we had some unused variables that we skipped linting. This
commit cleans up this by effectively removing those variables.
  • Loading branch information
Fabs committed Mar 5, 2018
1 parent fe5132d commit d7c03f1
Show file tree
Hide file tree
Showing 9 changed files with 1,104 additions and 804 deletions.
1,849 changes: 1,086 additions & 763 deletions npm-shrinkwrap.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ let thisHosts,
thisInstance,
thisResourceColor,
thisResourceLabel,
thisActiveSlices,
thisResourceType; // eslint-disable-line no-unused-vars
thisActiveSlices;

describe("NodesGridDials", function() {
beforeEach(function() {
Expand Down Expand Up @@ -147,10 +146,6 @@ describe("NodesGridDials", function() {
});

describe("#getDialConfig", function() {
beforeEach(function() {
thisResourceType = ResourcesUtil.cpus;
});

it("returns different configurations depending on the active parameter", function() {
let host = Object.assign({}, thisHosts[0]);
host.active = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ const MockFrameworks = require("./fixtures/MockFrameworks.json");
const ServicesList = require("../../structs/ServicesList");
const Framework = require("../../structs/Framework");

// eslint-disable-next-line no-unused-vars
let thisSelectedId,
thisHandleByServiceFilterChange,
let thisHandleByServiceFilterChange,
thisByServiceFilter,
thisContainer,
thisInstance;

describe("FilterByService", function() {
beforeEach(function() {
thisSelectedId = MockFrameworks.frameworks[0].id;

thisHandleByServiceFilterChange = function(id) {
thisByServiceFilter = id;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const APPEND = SystemLogTypes.APPEND;

let thisStoreStartTailing,
thisStoreStopTailing,
thisMesosLogStoreGet, // eslint-disable-line no-unused-vars
thisContainer,
thisInstance,
thisMesosLogStoreGetLogBuffer;
Expand All @@ -23,7 +22,6 @@ describe("MesosLogContainer", function() {
// Store original versions
thisStoreStartTailing = MesosLogStore.startTailing;
thisStoreStopTailing = MesosLogStore.stopTailing;
thisMesosLogStoreGet = MesosLogStore.get;

// Create spies
MesosLogStore.startTailing = jasmine.createSpy("startTailing");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const MesosStateStore = require("#SRC/js/stores/MesosStateStore");
const TaskTable = require("../TaskTable");
const Tasks = require("./fixtures/MockTasks.json").tasks;

// eslint-disable-next-line no-unused-vars
let thisContainer, thisInstance, thisTaskTable, thisGetNodeFromID;
let thisContainer, thisTaskTable, thisGetNodeFromID;

describe("TaskTable", function() {
beforeEach(function() {
Expand All @@ -24,7 +23,7 @@ describe("TaskTable", function() {

thisContainer = global.document.createElement("div");

thisInstance = ReactDOM.render(
ReactDOM.render(
JestUtil.stubRouterContext(TaskTable, {
tasks: Tasks,
params: { nodeID: "thing" }
Expand Down
20 changes: 8 additions & 12 deletions src/js/components/__tests__/ProgressBar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ const testData = [
}
];

// eslint-disable-next-line no-unused-vars
let thisContainer, thisInstance;
let thisContainer;

describe("#ProgressBar", function() {
beforeEach(function() {
thisContainer = global.document.createElement("div");
thisInstance = ReactDOM.render(
<ProgressBar data={testData} />,
thisContainer
);
ReactDOM.render(<ProgressBar data={testData} />, thisContainer);
});

afterEach(function() {
Expand All @@ -37,7 +33,7 @@ describe("#ProgressBar", function() {
describe("PropTypes", function() {
it("throws an error if no data prop is provided", function() {
spyOn(console, "error");
thisInstance = ReactDOM.render(<ProgressBar />, thisContainer);
ReactDOM.render(<ProgressBar />, thisContainer);
expect(console.error).toHaveBeenCalledWith(
"Warning: Failed prop type: " +
"The prop `data` is marked as required in `ProgressBar`, but its value " +
Expand All @@ -48,7 +44,7 @@ describe("#ProgressBar", function() {

it("throws an error if a data item is missing a value", function() {
spyOn(console, "error");
thisInstance = ReactDOM.render(
ReactDOM.render(
<ProgressBar
data={[
{
Expand All @@ -68,7 +64,7 @@ describe("#ProgressBar", function() {

it("throws an error if one data item is missing a value", function() {
spyOn(console, "error");
thisInstance = ReactDOM.render(
ReactDOM.render(
<ProgressBar
data={[
{
Expand All @@ -92,7 +88,7 @@ describe("#ProgressBar", function() {

it("does not throw an error if data does only contain a value field", function() {
spyOn(console, "error");
thisInstance = ReactDOM.render(
ReactDOM.render(
<ProgressBar
data={[
{
Expand All @@ -114,7 +110,7 @@ describe("#ProgressBar", function() {
});

it("contains test-bar (custom)", function() {
thisInstance = ReactDOM.render(
ReactDOM.render(
<ProgressBar data={testData} className="test-bar" />,
thisContainer
);
Expand All @@ -141,7 +137,7 @@ describe("#ProgressBar", function() {
});

it("has the class element-{index} if no classname is provided", function() {
thisInstance = ReactDOM.render(
ReactDOM.render(
<ProgressBar
data={[
{
Expand Down
5 changes: 2 additions & 3 deletions src/js/plugin-bridge/__tests__/ActionsPubSub-test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
const APPLICATION = require("../../constants/PluginConstants").APPLICATION;
const PluginSDK = require("PluginSDK");

// eslint-disable-next-line no-unused-vars
let thisMockFn, thisMockFn1, thisUnsubscribe, thisUnsubscribe1;
let thisMockFn, thisMockFn1, thisUnsubscribe;

describe("#ActionsPubSub", function() {
beforeEach(function() {
thisMockFn = jest.genMockFunction();
thisMockFn1 = jest.genMockFunction();
thisUnsubscribe = PluginSDK.onDispatch(thisMockFn);
thisUnsubscribe1 = PluginSDK.onDispatch(thisMockFn1);
PluginSDK.onDispatch(thisMockFn1);
});

it("receives actions after subscribing", function() {
Expand Down
8 changes: 3 additions & 5 deletions src/js/stores/__tests__/CosmosPackagesStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ let thisConfigUseFixture,
thisRequestFn,
thisPackagesSearchFixture,
thisPackageDescribeFixture,
thisPackageListVersionsFixture,
thisServiceDescribeFixture, // eslint-disable-line no-unused-vars
thisPackagesListFixture; // eslint-disable-line no-unused-vars
thisPackageListVersionsFixture;

describe("CosmosPackagesStore", function() {
beforeEach(function() {
Expand Down Expand Up @@ -317,7 +315,7 @@ describe("CosmosPackagesStore", function() {
RequestUtil.json = function(handlers) {
handlers.success(Object.assign({}, serviceDescribeFixture));
};
thisServiceDescribeFixture = Object.assign({}, serviceDescribeFixture);
Object.assign({}, serviceDescribeFixture);
});

afterEach(function() {
Expand Down Expand Up @@ -455,7 +453,7 @@ describe("CosmosPackagesStore", function() {
RequestUtil.json = function(handlers) {
handlers.success(Object.assign({}, packagesListFixture));
};
thisPackagesListFixture = Object.assign({}, packagesListFixture);
Object.assign({}, packagesListFixture);
});

afterEach(function() {
Expand Down
6 changes: 1 addition & 5 deletions src/js/utils/__tests__/TableUtil-test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
const MarathonStore = require("../../../../plugins/services/src/js/stores/MarathonStore");
const TableUtil = require("../TableUtil");
const Util = require("../Util");
const HealthSorting = require("../../../../plugins/services/src/js/constants/HealthSorting");

// eslint-disable-next-line no-unused-vars
let thisGetServiceHealth, thisFoo, thisBar, thisGetProp, thisSortFunction;
let thisFoo, thisBar, thisGetProp, thisSortFunction;

describe("TableUtil", function() {
beforeEach(function() {
thisGetServiceHealth = MarathonStore.getServiceHealth;

thisFoo = {
equal: 0,
id: "foo",
Expand Down

0 comments on commit d7c03f1

Please sign in to comment.