Merge pull request #603 from kolplattformen/feature/fix-vklass-deps
fix: jest configuration for vklass and hjärntorget
This commit is contained in:
commit
c202ca2af5
|
@ -1,9 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
displayName: 'api-hjarntorget',
|
||||||
testEnvironment: 'jsdom',
|
resolver: '@nrwl/jest/plugins/resolver',
|
||||||
transform: {
|
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||||
'.(ts|tsx)': 'ts-jest',
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||||
},
|
|
||||||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
|
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js'],
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,222 +1,248 @@
|
||||||
import { ApiHjarntorget } from './apiHjarntorget'
|
|
||||||
import { checkStatus } from './loginStatus'
|
|
||||||
import { wrapToughCookie } from '@skolplattformen/api'
|
import { wrapToughCookie } from '@skolplattformen/api'
|
||||||
import { CookieJar } from 'tough-cookie'
|
import { CookieJar } from 'tough-cookie'
|
||||||
|
import { ApiHjarntorget } from './apiHjarntorget'
|
||||||
|
|
||||||
const setupSuccessfullLoginInitiation = (fetcherMock: jest.Mock) => {
|
const setupSuccessfullLoginInitiation = (fetcherMock: jest.Mock) => {
|
||||||
// 'begin-login'
|
// 'begin-login'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
url: "some url with url encoded at the end?return=hello"
|
Promise.resolve({
|
||||||
}))
|
url: 'some url with url encoded at the end?return=hello',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'init-shibboleth-login'
|
// 'init-shibboleth-login'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
url: "some url with url encoded at the end?Target=hello"
|
Promise.resolve({
|
||||||
}))
|
url: 'some url with url encoded at the end?Target=hello',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'init-bankId'
|
// 'init-bankId'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
text: jest.fn().mockReturnValue(Promise.resolve(`
|
Promise.resolve({
|
||||||
|
text: jest.fn().mockReturnValue(
|
||||||
|
Promise.resolve(`
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<input name="RelayState" value="aUUID"></input>
|
<input name="RelayState" value="aUUID"></input>
|
||||||
<input name="SAMLRequest" value="somebase64value"></input>
|
<input name="SAMLRequest" value="somebase64value"></input>
|
||||||
</body>
|
</body>
|
||||||
</html>`))
|
</html>`)
|
||||||
}))
|
),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'pick-mvghost'
|
// 'pick-mvghost'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
url: "some url to a mvghost"
|
Promise.resolve({
|
||||||
}))
|
url: 'some url to a mvghost',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'start-bankId'
|
// 'start-bankId'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
url: "some base url to a mvghost to use when polling status"
|
Promise.resolve({
|
||||||
}))
|
url: 'some base url to a mvghost to use when polling status',
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setupSuccessfullBankIdLogin = (fetcherMock: jest.Mock) => {
|
const setupSuccessfullBankIdLogin = (fetcherMock: jest.Mock) => {
|
||||||
// 'poll-bankid-status'
|
// 'poll-bankid-status'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
json: jest.fn().mockReturnValue(Promise.resolve({
|
Promise.resolve({
|
||||||
infotext: "",
|
json: jest.fn().mockReturnValue(
|
||||||
location: "an url to go to confirm the login"
|
Promise.resolve({
|
||||||
}))
|
infotext: '',
|
||||||
}))
|
location: 'an url to go to confirm the login',
|
||||||
|
})
|
||||||
|
),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'confirm-signature-redirect'
|
// 'confirm-signature-redirect'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
text: jest.fn().mockReturnValue(Promise.resolve(`
|
Promise.resolve({
|
||||||
|
text: jest.fn().mockReturnValue(
|
||||||
|
Promise.resolve(`
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<textarea name="RelayState">relay state probably same uuid as before</textarea>
|
<textarea name="RelayState">relay state probably same uuid as before</textarea>
|
||||||
<textarea name="SAMLResponse">base64 encoded saml response</textarea>
|
<textarea name="SAMLResponse">base64 encoded saml response</textarea>
|
||||||
</body>
|
</body>
|
||||||
</html>`))
|
</html>`)
|
||||||
}))
|
),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'authgbg-saml-login'
|
// 'authgbg-saml-login'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({
|
fetcherMock.mockReturnValueOnce(
|
||||||
text: jest.fn().mockReturnValue(Promise.resolve(`
|
Promise.resolve({
|
||||||
|
text: jest.fn().mockReturnValue(
|
||||||
|
Promise.resolve(`
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<input name="RelayState" value="aUUID"></input>
|
<input name="RelayState" value="aUUID"></input>
|
||||||
<input name="SAMLResponse" value="somebase64value"></input>
|
<input name="SAMLResponse" value="somebase64value"></input>
|
||||||
</body>
|
</body>
|
||||||
</html>`))
|
</html>`)
|
||||||
}))
|
),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
// 'hjarntorget-saml-login'
|
// 'hjarntorget-saml-login'
|
||||||
fetcherMock.mockReturnValueOnce(Promise.resolve({ status: 200 }))
|
fetcherMock.mockReturnValueOnce(Promise.resolve({ status: 200 }))
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('api', () => {
|
describe('api', () => {
|
||||||
let fetcherMock: jest.Mock
|
let fetcherMock: jest.Mock
|
||||||
let api: ApiHjarntorget
|
let api: ApiHjarntorget
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const fetcher = jest.fn()
|
const fetcher = jest.fn()
|
||||||
fetcherMock = fetcher as jest.Mock
|
fetcherMock = fetcher as jest.Mock
|
||||||
|
|
||||||
const cookieManager = wrapToughCookie(new CookieJar())
|
|
||||||
cookieManager.clearAll();
|
|
||||||
api = new ApiHjarntorget(jest.fn(), cookieManager)
|
|
||||||
api.replaceFetcher(fetcher)
|
|
||||||
})
|
|
||||||
// describe('#login', () => {
|
|
||||||
// it('goes through single sing-on steps', async (done) => {
|
|
||||||
// setupSuccessfullLoginInitiation(fetcherMock)
|
|
||||||
// setupSuccessfullBankIdLogin(fetcherMock)
|
|
||||||
// const personalNumber = 'my personal number'
|
|
||||||
|
|
||||||
// const loginComplete = new Promise((resolve, reject) => {
|
const cookieManager = wrapToughCookie(new CookieJar())
|
||||||
// api.on('login', () => done())
|
cookieManager.clearAll()
|
||||||
// });
|
api = new ApiHjarntorget(jest.fn(), cookieManager)
|
||||||
// await api.login(personalNumber)
|
api.replaceFetcher(fetcher)
|
||||||
// })
|
})
|
||||||
// it('checker emits PENDING', async (done) => {
|
it('works', () => {
|
||||||
// // 'poll-bankid-status'
|
expect(1 + 1).toBe(2)
|
||||||
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
})
|
||||||
// json: jest.fn().mockReturnValue(Promise.resolve({
|
// describe('#login', () => {
|
||||||
// infotext: "some prompt to do signing in app",
|
// it('goes through single sing-on steps', async (done) => {
|
||||||
// location: ""
|
// setupSuccessfullLoginInitiation(fetcherMock)
|
||||||
// }))
|
// setupSuccessfullBankIdLogin(fetcherMock)
|
||||||
// }))
|
// const personalNumber = 'my personal number'
|
||||||
|
|
||||||
// const status = checkStatus(fetcherMock, "some url")
|
// const loginComplete = new Promise((resolve, reject) => {
|
||||||
// status.on('PENDING', () => {
|
// api.on('login', () => done())
|
||||||
// status.cancel()
|
// });
|
||||||
// done()
|
// await api.login(personalNumber)
|
||||||
// })
|
// })
|
||||||
// })
|
// it('checker emits PENDING', async (done) => {
|
||||||
// it('checker emits ERROR', async (done) => {
|
// // 'poll-bankid-status'
|
||||||
// // 'poll-bankid-status'
|
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
||||||
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
// json: jest.fn().mockReturnValue(Promise.resolve({
|
||||||
// json: jest.fn().mockReturnValue(Promise.resolve({
|
// infotext: "some prompt to do signing in app",
|
||||||
// infotext: "some prompt to do signing in app",
|
// location: ""
|
||||||
// location: "url with error in the name"
|
// }))
|
||||||
// }))
|
// }))
|
||||||
// }))
|
|
||||||
|
|
||||||
// const status = checkStatus(fetcherMock, "some url")
|
// const status = checkStatus(fetcherMock, "some url")
|
||||||
// status.on('ERROR', () => {
|
// status.on('PENDING', () => {
|
||||||
// status.cancel()
|
// status.cancel()
|
||||||
// done()
|
// done()
|
||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
// it('checker emits ERROR when an exception occurs', async (done) => {
|
// it('checker emits ERROR', async (done) => {
|
||||||
// // 'poll-bankid-status'
|
// // 'poll-bankid-status'
|
||||||
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
||||||
// json: jest.fn().mockReturnValue(Promise.resolve({
|
// json: jest.fn().mockReturnValue(Promise.resolve({
|
||||||
// infotext: undefined,
|
// infotext: "some prompt to do signing in app",
|
||||||
// location: undefined
|
// location: "url with error in the name"
|
||||||
// }))
|
// }))
|
||||||
// }))
|
// }))
|
||||||
|
|
||||||
// const status = checkStatus(fetcherMock, "some url")
|
// const status = checkStatus(fetcherMock, "some url")
|
||||||
// status.on('ERROR', () => {
|
// status.on('ERROR', () => {
|
||||||
// status.cancel()
|
// status.cancel()
|
||||||
// done()
|
// done()
|
||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
// it('remembers used personal number', async (done) => {
|
// it('checker emits ERROR when an exception occurs', async (done) => {
|
||||||
// setupSuccessfullLoginInitiation(fetcherMock)
|
// // 'poll-bankid-status'
|
||||||
// setupSuccessfullBankIdLogin(fetcherMock)
|
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
||||||
// const personalNumber = 'my personal number'
|
// json: jest.fn().mockReturnValue(Promise.resolve({
|
||||||
// await api.login(personalNumber)
|
// infotext: undefined,
|
||||||
// api.on('login', () => {
|
// location: undefined
|
||||||
// expect(api.getPersonalNumber()).toEqual(personalNumber)
|
// }))
|
||||||
// done()
|
// }))
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// it('forgets used personal number if sign in is unsuccessful', async (done) => {
|
|
||||||
// setupSuccessfullLoginInitiation(fetcherMock)
|
|
||||||
// // 'poll-bankid-status'
|
|
||||||
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
|
||||||
// json: jest.fn().mockReturnValue(Promise.resolve({
|
|
||||||
// infotext: "",
|
|
||||||
// location: "an url to go to confirm the login"
|
|
||||||
// }))
|
|
||||||
// }))
|
|
||||||
// // 'confirm-signature-redirect'
|
|
||||||
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
|
||||||
// text: Promise.resolve("some error occured")
|
|
||||||
// }))
|
|
||||||
|
|
||||||
// const personalNumber = 'my personal number'
|
// const status = checkStatus(fetcherMock, "some url")
|
||||||
// const status = await api.login(personalNumber)
|
// status.on('ERROR', () => {
|
||||||
|
// status.cancel()
|
||||||
|
// done()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// it('remembers used personal number', async (done) => {
|
||||||
|
// setupSuccessfullLoginInitiation(fetcherMock)
|
||||||
|
// setupSuccessfullBankIdLogin(fetcherMock)
|
||||||
|
// const personalNumber = 'my personal number'
|
||||||
|
// await api.login(personalNumber)
|
||||||
|
// api.on('login', () => {
|
||||||
|
// expect(api.getPersonalNumber()).toEqual(personalNumber)
|
||||||
|
// done()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// it('forgets used personal number if sign in is unsuccessful', async (done) => {
|
||||||
|
// setupSuccessfullLoginInitiation(fetcherMock)
|
||||||
|
// // 'poll-bankid-status'
|
||||||
|
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
||||||
|
// json: jest.fn().mockReturnValue(Promise.resolve({
|
||||||
|
// infotext: "",
|
||||||
|
// location: "an url to go to confirm the login"
|
||||||
|
// }))
|
||||||
|
// }))
|
||||||
|
// // 'confirm-signature-redirect'
|
||||||
|
// fetcherMock.mockReturnValueOnce(Promise.resolve({
|
||||||
|
// text: Promise.resolve("some error occured")
|
||||||
|
// }))
|
||||||
|
|
||||||
// status.on('ERROR', () => {
|
// const personalNumber = 'my personal number'
|
||||||
// expect(api.getPersonalNumber()).toEqual(undefined)
|
// const status = await api.login(personalNumber)
|
||||||
// done()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// // TODO: Possibly rewrite the mocking so we mock the responses more properly,
|
// status.on('ERROR', () => {
|
||||||
// // that way it would be possible to implement a throwIfNotOk wrapper for the
|
// expect(api.getPersonalNumber()).toEqual(undefined)
|
||||||
// // fetch calls.
|
// done()
|
||||||
// // it('throws error on external api error', async () => {
|
// })
|
||||||
// // const personalNumber = 'my personal number'
|
// })
|
||||||
// // try {
|
|
||||||
// // await api.login(personalNumber)
|
|
||||||
// // } catch (error: any) {
|
|
||||||
// // expect(error.message).toEqual(expect.stringContaining('Server Error'))
|
|
||||||
// // }
|
|
||||||
// // })
|
|
||||||
// })
|
|
||||||
// describe('#logout', () => {
|
|
||||||
// // it('clears session', async () => {
|
|
||||||
// // await api.logout()
|
|
||||||
// // const session = await api.getSession('')
|
|
||||||
// // expect(session).toEqual({
|
|
||||||
// // headers: {
|
|
||||||
// // cookie: '',
|
|
||||||
// // },
|
|
||||||
// // })
|
|
||||||
// // })
|
|
||||||
// it('emits logout event', async () => {
|
|
||||||
// const listener = jest.fn()
|
|
||||||
// api.on('logout', listener)
|
|
||||||
// await api.logout()
|
|
||||||
// expect(listener).toHaveBeenCalled()
|
|
||||||
// })
|
|
||||||
// it('sets .isLoggedIn', async () => {
|
|
||||||
// api.isLoggedIn = true
|
|
||||||
// await api.logout()
|
|
||||||
// expect(api.isLoggedIn).toBe(false)
|
|
||||||
// })
|
|
||||||
// it('forgets personalNumber', async () => {
|
|
||||||
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
// (api as any).personalNumber = 'my personal number'
|
|
||||||
// api.isLoggedIn = true
|
|
||||||
|
|
||||||
// await api.logout()
|
// // TODO: Possibly rewrite the mocking so we mock the responses more properly,
|
||||||
|
// // that way it would be possible to implement a throwIfNotOk wrapper for the
|
||||||
|
// // fetch calls.
|
||||||
|
// // it('throws error on external api error', async () => {
|
||||||
|
// // const personalNumber = 'my personal number'
|
||||||
|
// // try {
|
||||||
|
// // await api.login(personalNumber)
|
||||||
|
// // } catch (error: any) {
|
||||||
|
// // expect(error.message).toEqual(expect.stringContaining('Server Error'))
|
||||||
|
// // }
|
||||||
|
// // })
|
||||||
|
// })
|
||||||
|
// describe('#logout', () => {
|
||||||
|
// // it('clears session', async () => {
|
||||||
|
// // await api.logout()
|
||||||
|
// // const session = await api.getSession('')
|
||||||
|
// // expect(session).toEqual({
|
||||||
|
// // headers: {
|
||||||
|
// // cookie: '',
|
||||||
|
// // },
|
||||||
|
// // })
|
||||||
|
// // })
|
||||||
|
// it('emits logout event', async () => {
|
||||||
|
// const listener = jest.fn()
|
||||||
|
// api.on('logout', listener)
|
||||||
|
// await api.logout()
|
||||||
|
// expect(listener).toHaveBeenCalled()
|
||||||
|
// })
|
||||||
|
// it('sets .isLoggedIn', async () => {
|
||||||
|
// api.isLoggedIn = true
|
||||||
|
// await api.logout()
|
||||||
|
// expect(api.isLoggedIn).toBe(false)
|
||||||
|
// })
|
||||||
|
// it('forgets personalNumber', async () => {
|
||||||
|
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
// (api as any).personalNumber = 'my personal number'
|
||||||
|
// api.isLoggedIn = true
|
||||||
|
|
||||||
// expect(api.getPersonalNumber()).toEqual(undefined)
|
// await api.logout()
|
||||||
// })
|
|
||||||
// })
|
// expect(api.getPersonalNumber()).toEqual(undefined)
|
||||||
/*
|
// })
|
||||||
|
// })
|
||||||
|
/*
|
||||||
describe('fake', () => {
|
describe('fake', () => {
|
||||||
it('sets fake mode for the correct pnr:s', async () => {
|
it('sets fake mode for the correct pnr:s', async () => {
|
||||||
let status
|
let status
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"executor": "@nrwl/jest:jest",
|
"executor": "@nrwl/jest:jest",
|
||||||
"outputs": ["coverage/libs/api-skolplattformen"],
|
"outputs": ["coverage/libs/api-hjarntorget"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/api-skolplattformen/jest.config.js",
|
"jestConfig": "libs/api-hjarntorget/jest.config.js",
|
||||||
"passWithNoTests": true
|
"passWithNoTests": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
import '@testing-library/jest-native/extend-expect'
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"module": "commonjs",
|
||||||
|
"types": ["jest", "node"],
|
||||||
|
"composite": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.test.jsx",
|
||||||
|
"**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,13 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
displayName: 'api-skolplattformen',
|
displayName: 'api-skolplattformen',
|
||||||
preset: 'react-native',
|
|
||||||
resolver: '@nrwl/jest/plugins/resolver',
|
resolver: '@nrwl/jest/plugins/resolver',
|
||||||
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||||
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||||
transform: {
|
}
|
||||||
'\\.(js|ts|tsx)$': require.resolve('react-native/jest/preprocessor.js'),
|
|
||||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
|
|
||||||
'react-native/jest/assetFileTransformer.js'
|
|
||||||
),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
displayName: 'api-vklass',
|
||||||
testEnvironment: 'jsdom',
|
resolver: '@nrwl/jest/plugins/resolver',
|
||||||
transform: {
|
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||||
'.(ts|tsx)': 'ts-jest',
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||||
},
|
|
||||||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
|
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js'],
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,20 +14,5 @@
|
||||||
"lint": "eslint 'lib/**/*.{js,ts}' --quiet --fix",
|
"lint": "eslint 'lib/**/*.{js,ts}' --quiet --fix",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build": "tsc --build"
|
"build": "tsc --build"
|
||||||
},
|
}
|
||||||
"devDependencies": {
|
|
||||||
"@types/jest": "^26.0.22",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
|
||||||
"@typescript-eslint/parser": "^4.22.0",
|
|
||||||
"eslint": "^7.24.0",
|
|
||||||
"eslint-config-airbnb-typescript": "^12.3.1",
|
|
||||||
"eslint-config-prettier": "^8.2.0",
|
|
||||||
"eslint-plugin-import": "^2.22.1",
|
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
|
||||||
"jest": "^26.6.3",
|
|
||||||
"prettier": "^2.2.1",
|
|
||||||
"ts-jest": "^26.5.5",
|
|
||||||
"typescript": "^4.2.4"
|
|
||||||
},
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"executor": "@nrwl/jest:jest",
|
"executor": "@nrwl/jest:jest",
|
||||||
"outputs": ["coverage/libs/api-skolplattformen"],
|
"outputs": ["coverage/libs/api-vklass"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/api-vklass/jest.config.js",
|
"jestConfig": "libs/api-vklass/jest.config.js",
|
||||||
"passWithNoTests": true
|
"passWithNoTests": true
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
import '@testing-library/jest-native/extend-expect'
|
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
displayName: 'api',
|
||||||
testEnvironment: 'jsdom',
|
resolver: '@nrwl/jest/plugins/resolver',
|
||||||
transform: {
|
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
||||||
'.(ts|tsx)': 'ts-jest',
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
||||||
},
|
|
||||||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
|
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js'],
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
import '@testing-library/jest-native/extend-expect'
|
Loading…
Reference in New Issue