Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Nov 14, 2018
1 parent 165b647 commit 59ef199
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions __tests__/cli/index.js
Expand Up @@ -133,7 +133,7 @@ describe('cli', () => {

test('should use _id as foreignKeySuffix', async () => {
const response = await request.get('/posts/1/comments')
assert.equal(response.body.length, 1)
assert.strictEqual(response.body.length, 1)
})

test('should apply middlewares', done => {
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('cli', () => {
})

test('should save a snapshot in snapshots dir', () => {
assert.equal(fs.readdirSync(snapshotsDir).length, 1)
assert.strictEqual(fs.readdirSync(snapshotsDir).length, 1)
})
})

Expand Down
14 changes: 10 additions & 4 deletions __tests__/server/mixins.js
Expand Up @@ -31,7 +31,10 @@ describe('mixins', () => {
{ name: 'comments', id: 3 }
]

assert.deepEqual(_.getRemovable(db, { foreignKeySuffix: 'Id' }), expected)
assert.deepStrictEqual(
_.getRemovable(db, { foreignKeySuffix: 'Id' }),
expected
)
})

test('should support custom foreignKeySuffix', () => {
Expand All @@ -40,17 +43,20 @@ describe('mixins', () => {
{ name: 'comments', id: 3 }
]

assert.deepEqual(_.getRemovable(db, { foreignKeySuffix: 'Id' }), expected)
assert.deepStrictEqual(
_.getRemovable(db, { foreignKeySuffix: 'Id' }),
expected
)
})
})

describe('createId', () => {
test('should return a new id', () => {
assert.equal(_.createId(db.comments), 4)
assert.strictEqual(_.createId(db.comments), 4)
})

test('should return a new uuid', () => {
assert.notEqual(_.createId(db.photos), 3)
assert.notStrictEqual(_.createId(db.photos), 3)
})
})
})
4 changes: 2 additions & 2 deletions __tests__/server/plural-with-custom-foreign-key.js
Expand Up @@ -110,8 +110,8 @@ describe('Server with custom foreign key', () => {
.del('/posts/1')
.expect({})
.expect(200)
assert.equal(db.posts.length, 1)
assert.equal(db.comments.length, 1)
assert.strictEqual(db.posts.length, 1)
assert.strictEqual(db.comments.length, 1)
})
})
})
10 changes: 5 additions & 5 deletions __tests__/server/plural.js
Expand Up @@ -523,7 +523,7 @@ describe('Server', () => {
.expect('Content-Type', /json/)
.expect({ id: 3, body: 'foo', booleanValue: true, integerValue: 1 })
.expect(201)
assert.equal(db.posts.length, 3)
assert.strictEqual(db.posts.length, 3)
})

test('should support x-www-form-urlencoded', async () => {
Expand All @@ -535,7 +535,7 @@ describe('Server', () => {
// x-www-form-urlencoded will convert to string
.expect({ id: 3, body: 'foo', booleanValue: 'true', integerValue: '1' })
.expect(201)
assert.equal(db.posts.length, 3)
assert.strictEqual(db.posts.length, 3)
})

test('should respond with json, create a resource and generate string id', async () => {
Expand All @@ -544,7 +544,7 @@ describe('Server', () => {
.send({ url: 'http://foo.com', postId: 1 })
.expect('Content-Type', /json/)
.expect(201)
assert.equal(db.refs.length, 2)
assert.strictEqual(db.refs.length, 2)
})
})

Expand Down Expand Up @@ -656,8 +656,8 @@ describe('Server', () => {
.del('/posts/1')
.expect({})
.expect(200)
assert.equal(db.posts.length, 1)
assert.equal(db.comments.length, 3)
assert.strictEqual(db.posts.length, 1)
assert.strictEqual(db.comments.length, 3)
})

test('should respond with 404 if resource is not found', () =>
Expand Down
12 changes: 6 additions & 6 deletions __tests__/server/utils.js
Expand Up @@ -7,7 +7,7 @@ describe('utils', () => {
const perPage = 2

test('should return first page', () => {
assert.deepEqual(utils.getPage(array, 1, perPage), {
assert.deepStrictEqual(utils.getPage(array, 1, perPage), {
items: [1, 2],
current: 1,
first: 1,
Expand All @@ -17,7 +17,7 @@ describe('utils', () => {
})

test('should return second page', () => {
assert.deepEqual(utils.getPage(array, 2, perPage), {
assert.deepStrictEqual(utils.getPage(array, 2, perPage), {
items: [3, 4],
current: 2,
first: 1,
Expand All @@ -28,7 +28,7 @@ describe('utils', () => {
})

test('should return third page (last)', () => {
assert.deepEqual(utils.getPage(array, 3, perPage), {
assert.deepStrictEqual(utils.getPage(array, 3, perPage), {
items: [5],
current: 3,
first: 1,
Expand All @@ -38,19 +38,19 @@ describe('utils', () => {
})

test('should return an empty array if page is greater than the last page', () => {
assert.deepEqual(utils.getPage(array, 99, perPage), {
assert.deepStrictEqual(utils.getPage(array, 99, perPage), {
items: []
})
})

test('should return the array if perPage is greater than the array size', () => {
assert.deepEqual(utils.getPage(array, 1, 99), {
assert.deepStrictEqual(utils.getPage(array, 1, 99), {
items: array
})
})

test('should return an empty array if the array is empty', () => {
assert.deepEqual(utils.getPage([], 1, 1), {
assert.deepStrictEqual(utils.getPage([], 1, 1), {
items: []
})
})
Expand Down

0 comments on commit 59ef199

Please sign in to comment.