Skip to content

Commit

Permalink
feat(KUI-1511): update tests with respect to no of h4 headers and no …
Browse files Browse the repository at this point in the history
…of links
  • Loading branch information
allazis committed Oct 3, 2024
1 parent 1d8d151 commit 419fca8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions test/AdminStartPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('<AdminStartPage> (and subordinates)', () => {
test('Has correct h4 heading in correct order', done => {
const { getAllByRole } = renderEditPage()
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -55,7 +55,7 @@ describe('<AdminStartPage> (and subordinates)', () => {
test('Has correct buttons and links in correct order', done => {
const { getAllByRole } = renderEditPage()
const allLinks = getAllByRole('link')
expect(allLinks.length).toBe(8)
expect(allLinks.length).toBe(9)
expect(allLinks[0]).toHaveTextContent(/^Om kursen/)
expect(allLinks[0].href).toBe('https://www.kth.se/student/kurser/kurs/SF1624?l=sv')

Expand All @@ -76,13 +76,13 @@ describe('<AdminStartPage> (and subordinates)', () => {
expect(allLinks[5]).toHaveTextContent(/^Ladda upp kurs-PM som PDF/)
expect(allLinks[5].href).toBe('http://localhost/kursinfoadmin/pm/SF1624?l=sv')

expect(allLinks[6]).toHaveTextContent(/^Publicera ny/)
expect(allLinks[6].href).toBe(
expect(allLinks[7]).toHaveTextContent(/^Publicera ny/)
expect(allLinks[7].href).toBe(
'http://localhost/kursinfoadmin/kursutveckling/SF1624?l=sv&status=n&serv=admin&title=Algebra%20och%20geometri_7.5'
)

expect(allLinks[7]).toHaveTextContent(/^Ändra publicerad/)
expect(allLinks[7].href).toBe(
expect(allLinks[8]).toHaveTextContent(/^Ändra publicerad/)
expect(allLinks[8].href).toBe(
'http://localhost/kursinfoadmin/kursutveckling/SF1624?l=sv&status=p&serv=admin&title=Algebra%20och%20geometri_7.5'
)
done()
Expand Down
12 changes: 6 additions & 6 deletions test/RolesAdminStartPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User: only responsible. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(ONLY_RESPONSIBLE)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -126,7 +126,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User: only examinator. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(ONLY_EXAMINATOR)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -136,7 +136,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User: only superuser. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(ONLY_SUPERUSER)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -146,7 +146,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User has two roles: teacher and superuser. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(TEACHER_AND_SUPERUSER)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -156,7 +156,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User has two roles: teacher and examinator. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(TEACHER_AND_EXAMINATOR)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand All @@ -166,7 +166,7 @@ describe('User roles for this course <AdminStartPage>', () => {
test('User has two roles: teacher and resonsible. Show all cards: course memo, course description and course analysis', done => {
const { getAllByRole } = renderEditPage(TEACHER_AND_RESPONSIBLE)
const allH4Headers = getAllByRole('heading', { level: 4 })
expect(allH4Headers.length).toBe(3)
expect(allH4Headers.length).toBe(4)
expect(allH4Headers[0]).toHaveTextContent(/^Sidan Inför kursval/)
expect(allH4Headers[1]).toHaveTextContent(/^Kurs-PM/)
expect(allH4Headers[2]).toHaveTextContent(/^Kursanalys och kursdata/)
Expand Down

0 comments on commit 419fca8

Please sign in to comment.