소스 검색

refactor: fix throwing error style (#1210)

* - fix throwing error style
  - all throwing error should be starting with lower case

* - update test for fixing throwing error style
Bichi Kim 7 년 전
부모
커밋
38b236803d
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 4
      src/store.js
  2. 3 3
      test/unit/store.spec.js

+ 4 - 4
src/store.js

@@ -17,7 +17,7 @@ export class Store {
     if (process.env.NODE_ENV !== 'production') {
       assert(Vue, `must call Vue.use(Vuex) before creating a store instance.`)
       assert(typeof Promise !== 'undefined', `vuex requires a Promise polyfill in this browser.`)
-      assert(this instanceof Store, `Store must be called with the new operator.`)
+      assert(this instanceof Store, `store must be called with the new operator.`)
     }
 
     const {
@@ -74,7 +74,7 @@ export class Store {
 
   set state (v) {
     if (process.env.NODE_ENV !== 'production') {
-      assert(false, `Use store.replaceState() to explicit replace store state.`)
+      assert(false, `use store.replaceState() to explicit replace store state.`)
     }
   }
 
@@ -441,7 +441,7 @@ function registerGetter (store, type, rawGetter, local) {
 function enableStrictMode (store) {
   store._vm.$watch(function () { return this._data.$$state }, () => {
     if (process.env.NODE_ENV !== 'production') {
-      assert(store._committing, `Do not mutate vuex store state outside mutation handlers.`)
+      assert(store._committing, `do not mutate vuex store state outside mutation handlers.`)
     }
   }, { deep: true, sync: true })
 }
@@ -460,7 +460,7 @@ function unifyObjectStyle (type, payload, options) {
   }
 
   if (process.env.NODE_ENV !== 'production') {
-    assert(typeof type === 'string', `Expects string as the type, but found ${typeof type}.`)
+    assert(typeof type === 'string', `expects string as the type, but found ${typeof type}.`)
   }
 
   return { type, payload, options }

+ 3 - 3
test/unit/store.spec.js

@@ -53,7 +53,7 @@ describe('Store', () => {
     })
     expect(() => {
       store.commit(undefined, 2)
-    }).toThrowError(/Expects string as the type, but found undefined/)
+    }).toThrowError(/expects string as the type, but found undefined/)
     expect(store.state.a).toBe(1)
   })
 
@@ -206,7 +206,7 @@ describe('Store', () => {
     })
     expect(() => {
       store.dispatch(undefined, 2)
-    }).toThrowError(/Expects string as the type, but found undefined/)
+    }).toThrowError(/expects string as the type, but found undefined/)
     expect(store.state.a).toBe(1)
   })
 
@@ -267,7 +267,7 @@ describe('Store', () => {
   it('asserts the call with the new operator', () => {
     expect(() => {
       Vuex.Store({})
-    }).toThrowError(/Store must be called with the new operator/)
+    }).toThrowError(/store must be called with the new operator/)
   })
 
   it('should accept state as function', () => {