From: Eduardo San Martin Morote Date: Thu, 30 Sep 2021 08:24:33 +0000 (+0200) Subject: test: fix X-Git-Tag: pinia@2.0.0-rc.10~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69d50b5e5c3034097c04ccf6197fb68c93476a11;p=thirdparty%2Fvuejs%2Fpinia.git test: fix --- diff --git a/packages/pinia/__tests__/store.spec.ts b/packages/pinia/__tests__/store.spec.ts index b62686ba..1bae5068 100644 --- a/packages/pinia/__tests__/store.spec.ts +++ b/packages/pinia/__tests__/store.spec.ts @@ -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) }) })