Skip to content

Commit

Permalink
refactor: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
yzevm committed Jun 24, 2019
1 parent 35a959a commit 106cda3
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It's a simple `express` server
Run Mocha unit-tests

```sh
npm install
npm ci
npm run test:mocha
```

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"husky": "2.4.1",
"jest": "24.8.0",
"mocha": "6.1.4",
"request": "^2.88.0",
"request": "2.88.0",
"request-promise": "4.2.4",
"rimraf": "2.6.3",
"sinon": "7.3.2",
Expand All @@ -58,8 +58,7 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"post-push": "git run test"
"pre-push": "npm run lint"
}
}
}
2 changes: 1 addition & 1 deletion test/unit/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { postService } from '../../src/services'
import { Mock, post } from './utils'
import { Post } from '../../src/entities'

describe('mocha => typeorm => getConnection', () => {
describe('typeorm => getConnection', () => {
let mock: Mock

it('create method passed', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/createWithPicture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { postImageService } from '../../src/services'
import { Mock, post, images } from './utils'
import { Post } from '../../src/entities'

describe('mocha => typeorm => getConnection && createQueryBuilder', () => {
describe('typeorm => getConnection && createQueryBuilder', () => {
let mock1: Mock
let mock2: Mock

Expand Down
2 changes: 1 addition & 1 deletion test/unit/getAll.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { deepEqual } from 'assert'
import { postService } from '../../src/services/postService'
import { Mock, post } from './utils'

describe('mocha => typeorm => getManager', () => {
describe('typeorm => getManager', () => {
let mock: Mock

it('getAll method passed', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/getById.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { postService } from '../../src/services'
import { Mock, post } from './utils'
import { Post } from '../../src/entities'

describe('mocha => typeorm => createQueryBuilder', () => {
describe('typeorm => createQueryBuilder', () => {
let mock: Mock

it('getById method passed', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { deepEqual } from 'assert'
import { postService } from '../../src/services'
import { Mock, post } from './utils'

describe('mocha => typeorm => getRepository', () => {
describe('typeorm => getRepository', () => {
let mock: Mock

it('update method passed', async () => {
Expand Down
5 changes: 1 addition & 4 deletions test/unit/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ export class Mock {
this.sandbox = createSandbox()

if (args) {
this.sandbox
.stub(typeorm, method)
.withArgs(args)
.returns(fakeData)
this.sandbox.stub(typeorm, method).withArgs(args).returns(fakeData)
} else {
this.sandbox.stub(typeorm, method).returns(fakeData)
}
Expand Down

0 comments on commit 106cda3

Please sign in to comment.