@@ -5,7 +5,7 @@ import defaultState from '@/store/default-state'
55import buildGetters from '@/store/getters'
66import buildMutations from '@/store/mutations'
77import MockedServices from '@/spec/__mocks__/services'
8- import { page , normalizedPage } from '@/spec/__mocks__/page'
8+ import { page } from '@/spec/__mocks__/page'
99import { sectionsContent , normalizedSectionsContent } from '@/spec/__mocks__/sections-content'
1010import { site } from '@/spec/__mocks__/site'
1111import { theme } from '@/spec/__mocks__/theme'
@@ -31,11 +31,11 @@ describe('Getters', () => {
3131 } )
3232
3333 describe ( '#currentPagePath' , ( ) => {
34- let freshNormalizedPage = null
35- beforeEach ( ( ) => {
36- freshNormalizedPage = structuredClone ( normalizedPage )
37- mockedServices . page . normalize = vi . fn ( ( ) => freshNormalizedPage )
38- } )
34+ // let freshNormalizedPage = null
35+ // beforeEach(() => {
36+ // freshNormalizedPage = structuredClone(normalizedPage)
37+ // mockedServices.page.normalize = vi.fn(() => freshNormalizedPage)
38+ // })
3939 describe ( 'Given this is the home page' , ( ) => {
4040 it ( 'returns the path of the page' , ( ) => {
4141 store . commit ( 'SET_PAGE' , page )
@@ -44,39 +44,38 @@ describe('Getters', () => {
4444 } )
4545 describe ( 'Given this is a random page' , ( ) => {
4646 it ( 'returns the path of the page' , ( ) => {
47- freshNormalizedPage . entities . page [ '1' ] . path = '/bonjour'
48- freshNormalizedPage . entities . page [ '1' ] . liveUrl = '/fr/bonjour'
49- store . commit ( 'SET_PAGE' , page )
47+ const freshPage = structuredClone ( page )
48+ freshPage . path = '/bonjour'
49+ freshPage . liveUrl = '/fr/bonjour'
50+ store . commit ( 'SET_PAGE' , freshPage )
5051 expect ( store . getters . currentPagePath ) . toStrictEqual ( '/fr/bonjour' )
5152 } )
5253 } )
5354 describe ( 'Given the liveUrl contains the domain name' , ( ) => {
5455 it ( 'returns the path of the page' , ( ) => {
55- freshNormalizedPage . entities . page [ '1' ] . liveUrl = 'https://example.com:8080/fr'
56- freshNormalizedPage . entities . page [ '1' ] . path = 'index'
57- store . commit ( 'SET_PAGE' , page )
56+ const freshPage = structuredClone ( page )
57+ freshPage . liveUrl = 'https://example.com:8080/fr'
58+ freshPage . path = 'index'
59+ store . commit ( 'SET_PAGE' , freshPage )
5860 expect ( store . getters . currentPagePath ) . toStrictEqual ( '/fr/index' )
5961 } )
6062 } )
6163 } )
6264
6365 describe ( '#currentPageUrl' , ( ) => {
64- let freshNormalizedPage = null
65- beforeEach ( ( ) => {
66- freshNormalizedPage = structuredClone ( normalizedPage )
67- mockedServices . page . normalize = vi . fn ( ( ) => freshNormalizedPage )
68- } )
6966 describe ( 'Given the page live URL is not prefixed with the base URL' , ( ) => {
7067 it ( 'returns the url of the page' , ( ) => {
71- freshNormalizedPage . entities . page [ '1' ] . liveUrl = '/hello-world'
72- store . commit ( 'SET_PAGE' , page )
68+ const freshPage = structuredClone ( page )
69+ freshPage . liveUrl = '/hello-world'
70+ store . commit ( 'SET_PAGE' , freshPage )
7371 expect ( store . getters . currentPageUrl ) . toStrictEqual ( 'http://localhost:3000/hello-world' )
7472 } )
7573 } )
7674 describe ( 'Given the page live URL is prefixed with the base URL' , ( ) => {
7775 it ( 'returns the url of the page' , ( ) => {
78- freshNormalizedPage . entities . page [ '1' ] . liveUrl = 'https://example.com:8080/fr'
79- store . commit ( 'SET_PAGE' , page )
76+ const freshPage = structuredClone ( page )
77+ freshPage . liveUrl = 'https://example.com:8080/fr'
78+ store . commit ( 'SET_PAGE' , freshPage )
8079 expect ( store . getters . currentPageUrl ) . toStrictEqual ( 'https://example.com:8080/fr' )
8180 } )
8281 } )
0 commit comments