Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting globs #298

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"typings": "./index.d.ts",
"scripts": {
"umd-build": "rollup -c",
"build": "./node_modules/.bin/babel src --out-dir lib && npm run umd-build",
"lint-src": "./node_modules/.bin/eslint src/**/*.js",
"lint-test": "./node_modules/.bin/eslint test/**/*.js",
"build": "babel src --out-dir lib && npm run umd-build",
"lint-src": "eslint src/{**/,}*.js",
"lint-test": "eslint test/{**/,}*.js",
"lint": "npm run lint-src && npm run lint-test",
"prepublishOnly": "npm run build",
"pretest": "./node_modules/.bin/babel src --out-dir lib",
"test-run": "./node_modules/.bin/mocha --require @babel/register --recursive",
"pretest": "babel src --out-dir lib",
"test-run": "mocha --require @babel/register --recursive",
"test": "npm run lint && npm run test-run"
},
"repository": {
Expand Down
32 changes: 16 additions & 16 deletions test/wrapStore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { createWrapStore } from '../src';
import shallowDiff from '../src/strategies/shallowDiff/diff';
import { DISPATCH_TYPE, STATE_TYPE, PATCH_STATE_TYPE } from '../src/constants';

describe('wrapStore', function() {
describe('wrapStore', function () {
const channelName = 'test';

beforeEach(function() {
beforeEach(function () {
global.self = {};
const tabs = [1];

Expand Down Expand Up @@ -62,10 +62,10 @@ describe('wrapStore', function() {
return listeners;
}

describe("on receiving messages", function() {
describe("on receiving messages", function () {
let listeners, store, payload, message, sender, callback;

beforeEach(function() {
beforeEach(function () {
listeners = setupListeners();
store = {
dispatch: sinon.spy(),
Expand All @@ -87,7 +87,7 @@ describe('wrapStore', function() {
callback = () => { }; // noop. Maybe should validate it is invoked?
});

it('should dispatch actions received on onMessage to store', async function() {
it('should dispatch actions received on onMessage to store', async function () {
const wrapStore = createWrapStore();

wrapStore(store, { channelName });
Expand All @@ -105,7 +105,7 @@ describe('wrapStore', function() {
.should.eql(true);
});

it('should not dispatch actions received on onMessage for other ports', function() {
it('should not dispatch actions received on onMessage for other ports', function () {
const wrapStore = createWrapStore();

wrapStore(store, { channelName });
Expand All @@ -115,7 +115,7 @@ describe('wrapStore', function() {
store.dispatch.notCalled.should.eql(true);
});

it('should deserialize incoming messages correctly', async function() {
it('should deserialize incoming messages correctly', async function () {
const deserializer = sinon.spy(JSON.parse);
const wrapStore = createWrapStore();

Expand All @@ -135,7 +135,7 @@ describe('wrapStore', function() {
.should.eql(true);
});

it('should not deserialize incoming messages for other ports', function() {
it('should not deserialize incoming messages for other ports', function () {
const deserializer = sinon.spy(JSON.parse);
const wrapStore = createWrapStore();

Expand All @@ -148,7 +148,7 @@ describe('wrapStore', function() {
});
});

it('should serialize initial state and subsequent patches correctly', function() {
it('should serialize initial state and subsequent patches correctly', function () {
const sendMessage = (self.chrome.tabs.sendMessage = sinon.spy());

// Mock store subscription
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('wrapStore', function() {
sendMessage.secondCall.args[1].should.eql(expectedPatchMessage);
});

it('should use the provided diff strategy', function() {
it('should use the provided diff strategy', function () {
const sendMessage = (self.chrome.tabs.sendMessage = sinon.spy());

// Mock store subscription
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('wrapStore', function() {
sendMessage.secondCall.args[1].should.eql(expectedPatchMessage);
});

describe("when validating options", function() {
describe("when validating options", function () {
const store = {
dispatch: sinon.spy(),
subscribe: () => {
Expand All @@ -249,31 +249,31 @@ describe('wrapStore', function() {
getState: () => ({})
};

it('should use defaults if no options present', function() {
it('should use defaults if no options present', function () {
should.doesNotThrow(() => {
const wrapStore = createWrapStore();

wrapStore(store);
});
});

it('should throw an error if serializer is not a function', function() {
it('should throw an error if serializer is not a function', function () {
should.throws(() => {
const wrapStore = createWrapStore();

wrapStore(store, { channelName, serializer: "abc" });
}, Error);
});

it('should throw an error if deserializer is not a function', function() {
it('should throw an error if deserializer is not a function', function () {
should.throws(() => {
const wrapStore = createWrapStore();

wrapStore(store, { channelName, deserializer: "abc" });
}, Error);
});

it('should throw an error if diffStrategy is not a function', function() {
it('should throw an error if diffStrategy is not a function', function () {
should.throws(() => {
const wrapStore = createWrapStore();

Expand All @@ -284,7 +284,7 @@ describe('wrapStore', function() {

it(
'should send a safety message to all tabs once initialized',
function() {
function () {
const tabs = [123, 456, 789, 1011, 1213];
const tabResponders = [];
const store = {
Expand Down
Loading