Skip to content

Commit 346af06

Browse files
committed
style: Remove no-semi from prettier
1 parent 64aa8b8 commit 346af06

File tree

10 files changed

+194
-194
lines changed

10 files changed

+194
-194
lines changed

adapter-tests/unit-tests.js

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,227 +1,227 @@
11
module.exports = function testAdapter(options) {
22
describe('micro-analytics adapter ' + options.name, () => {
3-
const adapter = require(options.modulePath)
3+
const adapter = require(options.modulePath);
44

55
if (typeof options.beforeEach === 'function') {
66
beforeEach(async () => {
7-
await options.beforeEach(adapter)
8-
})
7+
await options.beforeEach(adapter);
8+
});
99
}
1010

1111
if (typeof options.afterEach === 'function') {
1212
afterEach(async () => {
13-
await options.afterEach(adapter)
14-
})
13+
await options.afterEach(adapter);
14+
});
1515
}
1616

1717
if (typeof options.beforeAll === 'function') {
1818
beforeAll(async () => {
19-
await options.beforeAll(adapter)
20-
})
19+
await options.beforeAll(adapter);
20+
});
2121
}
2222

2323
if (typeof options.afterAll === 'function') {
2424
afterAll(async () => {
25-
await options.afterAll(adapter)
25+
await options.afterAll(adapter);
2626
if (typeof adapter.close === 'function') {
27-
await adapter.close()
27+
await adapter.close();
2828
}
29-
})
29+
});
3030
}
3131

3232
test('get() should return a promise', () => {
33-
expect(adapter.get('/a-key').constructor.name).toEqual('Promise')
34-
})
33+
expect(adapter.get('/a-key').constructor.name).toEqual('Promise');
34+
});
3535

3636
test('getAll() should return a promise', () => {
3737
expect(adapter.getAll({ pathname: '/' }).constructor.name).toEqual(
3838
'Promise'
39-
)
40-
})
39+
);
40+
});
4141

4242
test('has() should return a promise', () => {
43-
expect(adapter.has('/a-key').constructor.name).toEqual('Promise')
44-
})
43+
expect(adapter.has('/a-key').constructor.name).toEqual('Promise');
44+
});
4545

4646
test('keys() should return a promise', () => {
47-
expect(adapter.keys().constructor.name).toEqual('Promise')
48-
})
47+
expect(adapter.keys().constructor.name).toEqual('Promise');
48+
});
4949

5050
test('put() should return a promise', () => {
51-
expect(adapter.put('/a-key', {}).constructor.name).toEqual('Promise')
52-
})
51+
expect(adapter.put('/a-key', {}).constructor.name).toEqual('Promise');
52+
});
5353

5454
if (typeof adapter.options !== 'undefined') {
5555
test('options should be an array of args options', () => {
56-
expect(Array.isArray(adapter.options)).toBe(true)
56+
expect(Array.isArray(adapter.options)).toBe(true);
5757
if (adapter.options.length >= 0) {
58-
let counter = 0
58+
let counter = 0;
5959
adapter.options.forEach(option => {
60-
expect(option.name).toBeDefined()
61-
expect(option.description).toBeDefined()
62-
counter++
63-
})
60+
expect(option.name).toBeDefined();
61+
expect(option.description).toBeDefined();
62+
counter++;
63+
});
6464

6565
// if the forEach somehow breaks the test should break
66-
expect(counter).toBe(adapter.options.length)
66+
expect(counter).toBe(adapter.options.length);
6767
}
68-
})
68+
});
6969

7070
test('init should be a defined when options is defined', () => {
71-
expect(typeof adapter.init).not.toBe('undefined')
72-
})
71+
expect(typeof adapter.init).not.toBe('undefined');
72+
});
7373
} else {
74-
test.skip('options should be an array of args options', () => {})
75-
test.skip('init should be a defined when options is defined', () => {})
74+
test.skip('options should be an array of args options', () => {});
75+
test.skip('init should be a defined when options is defined', () => {});
7676
}
7777

7878
if (typeof adapter.init !== 'undefined') {
7979
test('init should be a function', () => {
80-
expect(typeof adapter.init).toBe('function')
81-
})
80+
expect(typeof adapter.init).toBe('function');
81+
});
8282

8383
test('call init should not throw', () => {
84-
adapter.init(options.initOptions || {})
85-
})
84+
adapter.init(options.initOptions || {});
85+
});
8686
} else {
87-
test.skip('init should be a function', () => {})
88-
test.skip('call init should not throw', () => {})
87+
test.skip('init should be a function', () => {});
88+
test.skip('call init should not throw', () => {});
8989
}
9090

9191
it('should save and read', async () => {
92-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
92+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
9393

9494
expect(await adapter.get('/a-key')).toEqual({
9595
views: [{ time: 1490623474639 }]
96-
})
97-
})
96+
});
97+
});
9898

9999
it('should return empty list of views when key has no views', async () => {
100-
expect(await adapter.get('/c-key')).toEqual({ views: [] })
101-
})
100+
expect(await adapter.get('/c-key')).toEqual({ views: [] });
101+
});
102102

103103
it('should return all saves on getAll', async () => {
104-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
105-
await adapter.put('/another-key', { views: [{ time: 1490623474639 }] })
104+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
105+
await adapter.put('/another-key', { views: [{ time: 1490623474639 }] });
106106

107107
expect(await adapter.getAll({ pathname: '/' })).toEqual({
108108
'/a-key': { views: [{ time: 1490623474639 }] },
109109
'/another-key': { views: [{ time: 1490623474639 }] }
110-
})
111-
})
110+
});
111+
});
112112

113113
it('should return filtered saves from getAll based on pathname', async () => {
114-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
115-
await adapter.put('/another-key', { views: [{ time: 1490623474639 }] })
116-
await adapter.put('/b-key', { views: [{ time: 1490623474639 }] })
114+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
115+
await adapter.put('/another-key', { views: [{ time: 1490623474639 }] });
116+
await adapter.put('/b-key', { views: [{ time: 1490623474639 }] });
117117

118118
expect(await adapter.getAll({ pathname: '/a' })).toEqual({
119119
'/a-key': { views: [{ time: 1490623474639 }] },
120120
'/another-key': { views: [{ time: 1490623474639 }] }
121-
})
122-
})
121+
});
122+
});
123123

124124
it('should return filtered saves from getAll based on before', async () => {
125-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
126-
await adapter.put('/another-key', { views: [{ time: 1490623478639 }] })
127-
await adapter.put('/b-key', { views: [{ time: 1490623484639 }] })
125+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
126+
await adapter.put('/another-key', { views: [{ time: 1490623478639 }] });
127+
await adapter.put('/b-key', { views: [{ time: 1490623484639 }] });
128128

129129
expect(
130130
await adapter.getAll({ pathname: '/', before: 1490623478640 })
131131
).toEqual({
132132
'/a-key': { views: [{ time: 1490623474639 }] },
133133
'/another-key': { views: [{ time: 1490623478639 }] },
134134
'/b-key': { views: [] }
135-
})
136-
})
135+
});
136+
});
137137

138138
it('should return filtered saves from getAll based on after', async () => {
139-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
140-
await adapter.put('/another-key', { views: [{ time: 1490623478639 }] })
141-
await adapter.put('/b-key', { views: [{ time: 1490623484639 }] })
139+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
140+
await adapter.put('/another-key', { views: [{ time: 1490623478639 }] });
141+
await adapter.put('/b-key', { views: [{ time: 1490623484639 }] });
142142

143143
expect(
144144
await adapter.getAll({ pathname: '/', after: 1490623478638 })
145145
).toEqual({
146146
'/a-key': { views: [] },
147147
'/another-key': { views: [{ time: 1490623478639 }] },
148148
'/b-key': { views: [{ time: 1490623484639 }] }
149-
})
150-
})
149+
});
150+
});
151151

152152
it('should return filtered saves from get based on before', async () => {
153153
await adapter.put('/a-key', {
154154
views: [{ time: 1490623474639 }, { time: 1490623478639 }]
155-
})
155+
});
156156

157157
expect(await adapter.get('/a-key', { before: 1490623475640 })).toEqual({
158158
views: [{ time: 1490623474639 }]
159-
})
160-
})
159+
});
160+
});
161161

162162
it('should return filtered saves from get based on after', async () => {
163163
await adapter.put('/a-key', {
164164
views: [{ time: 1490623474639 }, { time: 1490623478639 }]
165-
})
165+
});
166166

167167
expect(await adapter.get('/a-key', { after: 1490623475640 })).toEqual({
168168
views: [{ time: 1490623478639 }]
169-
})
170-
})
169+
});
170+
});
171171

172172
it('should have check whether a key is stored with has', async () => {
173-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
173+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
174174

175-
expect(await adapter.has('/a-key')).toEqual(true)
176-
expect(await adapter.has('/non-existing-key')).toEqual(false)
177-
})
175+
expect(await adapter.has('/a-key')).toEqual(true);
176+
expect(await adapter.has('/non-existing-key')).toEqual(false);
177+
});
178178

179179
if (typeof adapter.subscribe === 'function') {
180180
it('should allow subscription with observables', async () => {
181-
const listener = jest.fn()
182-
const unsubscribe = adapter.subscribe(listener)
181+
const listener = jest.fn();
182+
const unsubscribe = adapter.subscribe(listener);
183183

184-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
184+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
185185

186186
expect(listener).toHaveBeenCalledWith({
187187
key: '/a-key',
188188
value: { views: [{ time: 1490623474639 }] }
189-
})
190-
})
189+
});
190+
});
191191

192192
it('should allow multiple subscription with observables and handle unsubscribption', async () => {
193-
const listener1 = jest.fn()
194-
const listener2 = jest.fn()
195-
const subscription = adapter.subscribe(listener1)
196-
adapter.subscribe(listener2)
193+
const listener1 = jest.fn();
194+
const listener2 = jest.fn();
195+
const subscription = adapter.subscribe(listener1);
196+
adapter.subscribe(listener2);
197197

198-
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] })
199-
subscription.unsubscribe()
200-
await adapter.put('/b-key', { views: [{ time: 1490623474639 }] })
198+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
199+
subscription.unsubscribe();
200+
await adapter.put('/b-key', { views: [{ time: 1490623474639 }] });
201201

202202
expect(listener1).toHaveBeenCalledWith({
203203
key: '/a-key',
204204
value: { views: [{ time: 1490623474639 }] }
205-
})
205+
});
206206
expect(listener1).not.toHaveBeenCalledWith({
207207
key: '/b-key',
208208
value: { views: [{ time: 1490623474639 }] }
209-
})
209+
});
210210
expect(listener2).toHaveBeenCalledWith({
211211
key: '/a-key',
212212
value: { views: [{ time: 1490623474639 }] }
213-
})
213+
});
214214
expect(listener2).toHaveBeenCalledWith({
215215
key: '/b-key',
216216
value: { views: [{ time: 1490623474639 }] }
217-
})
218-
})
217+
});
218+
});
219219
} else {
220-
it.skip('should allow subscription with observables', () => {})
220+
it.skip('should allow subscription with observables', () => {});
221221
it.skip(
222222
'should allow multiple subscription with observables and handle unsubscribption',
223223
() => {}
224-
)
224+
);
225225
}
226-
})
227-
}
226+
});
227+
};

adapter-tests/unit-tests.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const { mockDb } = require('../tests/utils')
1+
const { mockDb } = require('../tests/utils');
22

3-
jest.mock('flat-file-db', () => mockDb)
3+
jest.mock('flat-file-db', () => mockDb);
44

5-
const test = require('./unit-tests')
5+
const test = require('./unit-tests');
66

77
test({
88
name: 'flat-file-db',
99
modulePath: 'micro-analytics-adapter-flat-file-db',
1010
beforeEach: async () => {
11-
mockDb._reset()
11+
mockDb._reset();
1212
}
13-
})
13+
});

cli.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env node
22

3-
const { exec } = require('shelljs')
4-
const updateNotifier = require('update-notifier')
5-
const pkg = require('./package.json')
3+
const { exec } = require('shelljs');
4+
const updateNotifier = require('update-notifier');
5+
const pkg = require('./package.json');
66

7-
updateNotifier({ pkg }).notify()
7+
updateNotifier({ pkg }).notify();
88

99
const supportsAsyncAwait =
10-
parseInt(process.version.slice(1).split('.').join('')) > 760
10+
parseInt(process.version.slice(1).split('.').join('')) > 760;
1111

12-
const microAnalytics = supportsAsyncAwait ? './src/index' : './dist/index'
12+
const microAnalytics = supportsAsyncAwait ? './src/index' : './dist/index';
1313

14-
require(microAnalytics)
14+
require(microAnalytics);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"dev": "NODE_ENV=development nodemon --config package.json --exec async-node src/index.js",
2525
"test": "jest",
2626
"test-now-deployment": "curl --fail $NOW_URL/test?inc=false",
27-
"format": "prettier --no-semi --single-quote --write 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'",
28-
"lint": "prettier-check --no-semi --single-quote 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'"
27+
"format": "prettier --single-quote --write 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'",
28+
"lint": "prettier-check --single-quote 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'"
2929
},
3030
"jest": {
3131
"collectCoverageFrom": [

0 commit comments

Comments
 (0)