فهرست منبع

Skip intermittent failing test and add more testing advice

Gabriel Horner 3 سال پیش
والد
کامیت
f26681c2ee
2فایلهای تغییر یافته به همراه16 افزوده شده و 1 حذف شده
  1. 15 0
      docs/dev-practices.md
  2. 1 1
      e2e-tests/flashcards.spec.ts

+ 15 - 0
docs/dev-practices.md

@@ -88,6 +88,10 @@ Our unit tests use the [shadow-cljs test-runner](https://shadow-cljs.github.io/d
 yarn test
 ```
 
+By convention, a namespace's tests are found at a corresponding namespace
+of the same name with an added `-test` suffix. For example, tests
+for `frontend.db.model` are found in `frontend.db.model-test`.
+
 There are a couple different ways to develop with tests:
 
 #### Focus Tests
@@ -115,6 +119,17 @@ To run tests automatically on file save, run `clojure -M:test watch test
 the `:ns-regexp` option e.g. `clojure -M:test watch test --config-merge
 '{:autorun true :ns-regexp "frontend.util.page-property-test"}'`.
 
+#### Database tests
+
+To write a test that uses a datascript db:
+
+* Be sure your test ns has test fixtures from `test-helper` ns to create and
+  destroy test databases after each test.
+* The easiest way to set up test data is to use `test-helper/load-test-files`.
+* For the repo argument that most fns take, pass it `test-helper/test-db`
+
+For examples of these tests, see `frontend.db.query-dsl-test` and `frontend.db.model-test`.
+
 ## Logging
 
 For logging, we use https://github.com/lambdaisland/glogi. When in development,

+ 1 - 1
e2e-tests/flashcards.spec.ts

@@ -3,7 +3,7 @@ import { test } from './fixtures'
 import { createRandomPage } from './utils'
 
 
-test('flashcard demo', async ({ page, block }) => {
+test.skip('flashcard demo', async ({ page, block }) => {
   await createRandomPage(page)
 
   await block.mustFill('Why do you add cards? #card #logseq')