]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: reactive unit test
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Mar 2020 10:29:22 +0000 (11:29 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 24 Mar 2020 15:09:43 +0000 (16:09 +0100)
__tests__/history/html5.spec.ts

index 641b99b0243bd4e20533abd553a67768e76f359c..dc44100b032050702e3a288dda496586946e1b04 100644 (file)
@@ -1,14 +1,17 @@
 import createWebHistory from '../../src/history/html5'
 import { createDom } from '../utils'
 
-// TODO: is it really worth testing this implementation on jest or is it
-// better to directly use e2e tests instead
-describe.skip('History HTMl5', () => {
+// These unit tests are supposed to tests very specific scenarios that are easier to setup
+// on a unit test than an e2e tests
+describe('History HTMl5', () => {
   beforeAll(() => {
     createDom()
   })
 
-  it('can be instantiated', () => {
+  // this problem is very common on hash history when using a regular link
+  // it will push an entry into the history stack with no state.
+  // When navigating back, we will try to read `state` but it will be null
+  it('should not fail if an entry has an empty state', () => {
     const history = createWebHistory()
     expect(history.location).toEqual({
       fullPath: '/',