diff --git a/pages/API/interceptor/interceptor.test.js b/pages/API/interceptor/interceptor.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5006a8a6b31e53d9a3a9fae9d6ec28e6860f13c3 --- /dev/null +++ b/pages/API/interceptor/interceptor.test.js @@ -0,0 +1,35 @@ +const PAGE_PATH = '/pages/API/interceptor/interceptor' + +describe('interceptor', () => { + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor('view') + }) + + it('no Interceptor', async () => { + const newPage = await program.navigateTo('./page1') + await newPage.waitFor('text') + const num = (await newPage.data()).page + await program.navigateBack() + expect(num).toBe(1) + }) + + it('addInterceptor', async () => { + await page.callMethod('addInterceptor') + const newPage = await program.navigateTo('./page1') + await newPage.waitFor('text') + const num = (await newPage.data()).page + await program.navigateBack() + expect(num).toBe(2) + }) + + it('removeInterceptor', async () => { + await page.callMethod('removeInterceptor') + const newPage = await program.navigateTo('./page1') + await newPage.waitFor('text') + const num = (await newPage.data()).page + await program.navigateBack() + expect(num).toBe(1) + }) +}) \ No newline at end of file diff --git a/pages/API/interceptor/page1.uvue b/pages/API/interceptor/page1.uvue index aa01b473a94c30a5399977821578be130cf4a0a5..76063882b63a9de6cec77d1fa0fbd89a7af7fc94 100644 --- a/pages/API/interceptor/page1.uvue +++ b/pages/API/interceptor/page1.uvue @@ -1,22 +1,22 @@ - - - - - \ No newline at end of file diff --git a/pages/API/interceptor/page2.uvue b/pages/API/interceptor/page2.uvue index f75d1e6c926d138f280a8376dd65a4c5f6d3828e..e97ad1f3f961c802677cee1ef67819aeefe1dcdb 100644 --- a/pages/API/interceptor/page2.uvue +++ b/pages/API/interceptor/page2.uvue @@ -1,22 +1,22 @@ - - - - - \ No newline at end of file