Skip to content

Commit

Permalink
fix: reconfigure jest
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcherist committed Jul 1, 2018
1 parent a646c47 commit 31f5b72
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 26 deletions.
17 changes: 17 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"ramda": "^0.25.0"
},
"devDependencies": {
"@types/jest": "^23.1.3",
"@types/node": "^10.5.1",
"conventional-changelog-cli": "^2.0.0",
"conventional-github-releaser": "^3.1.0",
Expand All @@ -54,6 +55,7 @@
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"jest": "^23.2.0",
"ts-jest": "^23.0.0",
"tslint": "^5.10.0",
"typescript": "^2.9.2",
"typescript-eslint-parser": "^16.0.1"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const ButtonBuilder = require('../buttonBuilder')
// const ButtonBuilder = require('../buttonBuilder')
import ButtonBuilder from '../buttonBuilder'

test('common test for buttonBuilder', () => {
const expected = {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/commands.spec.js → src/tests/commands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ test('adding a command', () => {
expect(commands.getByName('Привет, алиса!')).toEqual({
name: 'Привет, алиса!',
callback: cb,
type: 'string'
type: 'string',
})
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/tests/sessions.spec.js → src/tests/sessions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ test('session methods', () => {
expect(session.sessionId).toBe('some-session-id')

const mockedSet = {
foo: 'bar'
foo: 'bar',
}
session.set(mockedSet)
expect(session.data).toEqual(mockedSet)

const mockedUpdate = {
bar: 'baz',
foo: 'foo'
foo: 'foo',
}
session.update(mockedUpdate)
expect(session.data).toEqual(mockedUpdate)
Expand All @@ -33,7 +33,7 @@ test('Creating session array', () => {
it should change in sessions too
*/
const mockedUpdate = {
foo: 'bar'
foo: 'bar',
}
session.update(mockedUpdate)
expect(sessions.find(session)).toEqual(session)
Expand Down
20 changes: 0 additions & 20 deletions src/tests/testUtils.js

This file was deleted.

20 changes: 20 additions & 0 deletions src/tests/testUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const generateRequest = (commandText, utteranceText) => ({
meta: {
client_id: 'Developer Console',
locale: 'ru-RU',
timezone: 'UTC',
},
request: {
command: commandText,
original_utterance: utteranceText || commandText,
type: 'SimpleUtterance',
},
session: {
message_id: 0,
new: true,
session_id: '6d0d2a2e-f14149b9-33febdb2-8037',
},
version: '1.0',
})

module.exports.generateRequest = generateRequest
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src/types/*"
]
},
"types": ["node"],
"types": ["node", "jest"],
// typeRoots option has been previously configured
"typeRoots": [
// add path to @types
Expand Down

0 comments on commit 31f5b72

Please sign in to comment.