]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: fix
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 30 Sep 2021 08:24:33 +0000 (10:24 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 30 Sep 2021 08:24:33 +0000 (10:24 +0200)
packages/pinia/__tests__/store.spec.ts

index b62686baf6eea991a594119f6b0449375c4cbde3..1bae5068dbbf84635ef6163eaf64f8c6c70b59b0 100644 (file)
@@ -334,6 +334,8 @@ describe('Store', () => {
     expect(useStore()).not.toBe(store)
   })
 
+  const warnTextCheckPlainObject = `"state" must be a plain object`
+
   it('warns when state is created with a class constructor', () => {
     class MyState {}
 
@@ -342,7 +344,7 @@ describe('Store', () => {
       state: () => new MyState(),
     })
     useMyStore()
-    expect('Detected constructor usage').toHaveBeenWarned()
+    expect(warnTextCheckPlainObject).toHaveBeenWarned()
   })
 
   it('only warns about constructors when store is initially created', () => {
@@ -352,7 +354,7 @@ describe('Store', () => {
       state: () => new MyState(),
     })
     useMyStore()
-    expect('Detected constructor usage').toHaveBeenWarnedTimes(1)
+    expect(warnTextCheckPlainObject).toHaveBeenWarnedTimes(1)
   })
 
   it('does not warn when state is created with a plain object', () => {
@@ -361,6 +363,6 @@ describe('Store', () => {
       state: () => ({ someValue: undefined }),
     })
     useMyStore()
-    expect('Detected constructor usage').toHaveBeenWarnedTimes(0)
+    expect(warnTextCheckPlainObject).toHaveBeenWarnedTimes(0)
   })
 })