misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
10.04k stars 1.37k forks source link

Add unit tests for client package #9345

Open saschanaz opened 1 year ago

saschanaz commented 1 year ago

I'd like to add some tests since there's no tests AFAICT.

pixeldesu commented 1 year ago

Well, there are no direct unit tests of components, but there are E2E tests for the client in cypress/

saschanaz commented 1 year ago

Good point, changing the title.

syuilo commented 1 year ago

Does this mean testing each Vue component?

syuilo commented 1 year ago

If so, I don't know because I have never written unit tests for Vue, but I feel it would be a difficult task since many components rely on global state.

saschanaz commented 1 year ago

I'd start with splitting some Jest-runnable subfeatures used by Vue components and testing them, e.g. image compression configuration function I added in #9334, rather than testing full Vue components themselves. Such thing should be easier with Cypress I guess.

tamaina commented 1 year ago

Vue/ViteのテストはVitestでテストを書けば良さそう?

モジュールのmockもできる

https://vitest.dev/api/vi.html#vi-domock

acid-chicken commented 1 year ago

Related to #10336

acid-chicken commented 1 year ago

でもそれはそれとしてグローバルステートはストアとかは良いけど Web API (HTTP API じゃない方) の直接依存は剥がしたい

saschanaz commented 1 year ago

https://github.com/misskey-dev/misskey/tree/develop/packages/frontend/test ここにユニットテスト少しあります