Skip to content

Commit 98b8cbc

Browse files
committed
more docs
1 parent 4b8cb8f commit 98b8cbc

File tree

7 files changed

+531
-5
lines changed

7 files changed

+531
-5
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "nebula-docs",
2+
"name": "preflight-docs",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
@@ -9,7 +9,7 @@
99
"start": "next start"
1010
},
1111
"author": "",
12-
"license": "ISC",
12+
"license": "Apache-2.0",
1313
"dependencies": {
1414
"next": "^14.2.8",
1515
"nextra": "^3.2.5",

docs/pages/_meta.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export default {
2+
// Controlling the order these are shown in the sidebar
23
"index": "Getting started",
4+
"writing-tests" : "Writing tests",
5+
"stubbing" : "Stubbing responses",
6+
"faq" : "Tips and FAQ's"
37
};

docs/pages/faq.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Tips and FAQs
3+
---
4+
# Tips and FAQ's
5+
6+
7+
### How do I get the command line to show me the tests that have been run?
8+
By default, the Gradle output is quite quiet (compared to Maven or other build tools).
9+
10+
To get more information about tests as they're being run, add the following to your `build.gradle.kts`:
11+
12+
```kotlin
13+
tasks.test {
14+
testLogging {
15+
events("started", "passed", "failed", "skipped")
16+
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.SHORT
17+
showStandardStreams = false
18+
}
19+
}
20+
```
21+
22+
### Where are the test reports
23+
* An HTML browsable output is created at `build/reports/tests/test/index.html`
24+
* The standard XML test reports (JUnit style) are at `build/repoirts/test-results/test`
25+
26+
27+
### My test failed, but the two numbers look the same
28+
This is a common issue:
29+
30+
```
31+
io.kotest.assertions.AssertionFailedError: Values differed at keys amount
32+
expected:<{
33+
"value" = 100
34+
}> but was:<{
35+
"value" = 100
36+
}>
37+
```
38+
39+
When types in Taxi are declared as `Decimal`, then they are returned to the JVM as `BigDecimal`.
40+
41+
For example, given the model:
42+
43+
```taxi
44+
model Purchase {
45+
value : Amount inherits Decimal
46+
}
47+
```
48+
49+
Then in a test:
50+
51+
```kotlin
52+
it("should compare decimal numbers") {
53+
"""
54+
given { Purchase = { value: 20 } }
55+
find { Purchase }
56+
""".queryForObject()
57+
.shouldBe(mapOf(
58+
"value" to 20, // wrong - don't do this
59+
"value" to 20.toBigDecimal(), // correct - do this
60+
))
61+
}
62+
```

docs/pages/index.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ plugins {
2828
}
2929
```
3030

31+
You also need a `settings.gradle.kts` (but can be blank)
32+
33+
```kotlin
34+
// settings.gradle.kts
35+
// This file can be left blank
36+
```
37+
3138
Then, to write your first test, create a folder `test` next to your `src` folder.
3239
By convention, these are named ending in `Spec.kt` or `Test.kt`.
3340

3441
```kotlin
3542
// test/HelloWorldSpec.kt
43+
import com.orbitalhq.preflight.dsl.OrbitalSpec
44+
import io.kotest.matchers.shouldBe
3645

3746
class HelloWorldSpec : OrbitalSpec({
3847
describe("First test") {

0 commit comments

Comments
 (0)