Skip to content

Commit

Permalink
test(tutorial): add jest.config.js and change output string
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Feb 22, 2024
1 parent 4dc738c commit 8349f18
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tutorial/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('path')

module.exports = {
rootDir: 'tests',
transform: {
'^.+\\.jsx?$': [
'babel-jest',
{ configFile: path.resolve(__dirname, 'babel.config.js') },
],
},
transformIgnorePatterns: ['/node_modules/(?!@botonic).+\\.(js|jsx|ts|tsx)$'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(scss|css|less)$': '<rootDir>/__mocks__/styleMock.js',
},
}
5 changes: 3 additions & 2 deletions tutorial/tests/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import { routes } from '../src/routes'

const app = new NodeApp({ routes, locales, plugins, ...config })


const input = new BotonicInputTester(app)
const output = new BotonicOutputTester(app)

test('TEST: (404) NOT FOUND', async () => {
const response = await input.text('whatever')
expect(response).toBe(output.text("I don't understand you"))
expect(response).toBe(
output.text('Please, type "start" to start the tutorial.'),
)
})

0 comments on commit 8349f18

Please sign in to comment.