test: fix tests (#429)

* test: fix tests

* chore: use correct phone number

* chore: remove package-lock

* chore(deps): update vulnerabilities
This commit is contained in:
Rickard Natt och Dag 2021-08-16 19:38:59 +02:00 committed by GitHub
parent 2b722d6048
commit e4d6ba1bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 15371 deletions

15358
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,12 @@ import {
import { render } from '../../utils/testHelpers'
import React from 'react'
import { Children } from '../children.component'
import { useNavigation } from '@react-navigation/native'
import { useNavigation } from '@react-navigation/core'
import * as RNLocalize from 'react-native-localize'
import { translate } from '../../utils/translation'
jest.mock('@skolplattformen/api-hooks')
jest.mock('@react-navigation/native')
jest.mock('@react-navigation/core')
jest.mock('react-native-localize')
const setup = () => {
return render(<Children />)
@ -35,7 +35,7 @@ beforeEach(() => {
useNews.mockReturnValueOnce({ data: [], status: 'loaded' })
useSchedule.mockReturnValueOnce({ data: [], status: 'loaded' })
useMenu.mockReturnValueOnce({ data: [], status: 'loaded' })
useNavigation.mockReturnValue({ navigate: jest.fn() })
useNavigation.mockReturnValue({ navigate: jest.fn(), setOptions: jest.fn() })
})
test('renders loading state', () => {

View File

@ -55,7 +55,6 @@ test('gets article details using useNewsDetails', () => {
test('renders an article', () => {
const screen = setup()
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
expect(screen.getByText('Publicerad: 15 feb 2021 10:13')).toBeTruthy()
expect(screen.getByText('Uppdaterad: 15 feb 2021 10:13')).toBeTruthy()
@ -69,7 +68,6 @@ test('renders an article without published date if date is invalid', () => {
const screen = setup({ newsItem: newsItemWithoutPublishedDate })
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
expect(screen.getByText('Uppdaterad: 15 feb 2021 10:13')).toBeTruthy()
expect(screen.queryByText('Publicerad: Invalid DateTime')).toBeFalsy()
@ -83,7 +81,6 @@ test('renders an article without modified date if date is invalid', () => {
const screen = setup({ newsItem: newsItemWithoutPublishedDate })
expect(screen.getByText(/k-bullar!/i)).toBeTruthy()
expect(screen.getByText(/nu blir det köttbullar/i)).toBeTruthy()
expect(screen.getByText('Publicerad: 15 feb 2021 10:13')).toBeTruthy()
expect(screen.queryByText('Uppdaterad: Invalid DateTime')).toBeFalsy()

View File

@ -1,6 +1,6 @@
import { Linking, Platform } from 'react-native'
const phoneNumber = '+46701234567'
const phoneNumber = '+46730121740'
export const useSMS = () => {
const sendSMS = async (message) => {

View File

@ -3369,9 +3369,9 @@ path-key@^3.0.0, path-key@^3.1.0:
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-type@^1.0.0:
version "1.1.0"
@ -4235,9 +4235,9 @@ trim-newlines@^1.0.0:
integrity sha1-WIeWa7WCpFA6QetST301ARgVphM=
trim-newlines@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.0.tgz#79726304a6a898aa8373427298d54c2ee8b1cb30"
integrity sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==
version "3.0.1"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==
trim-off-newlines@^1.0.0:
version "1.0.1"