|
| 1 | +// This file was automatically generated from tuples.md by Knit tool. Do not edit. |
| 2 | +@file:Suppress("JSUnusedLocalSymbols") |
| 3 | +package dev.adamko.kxstsgen.example.test |
| 4 | + |
| 5 | +import io.kotest.matchers.* |
| 6 | +import kotlinx.knit.test.* |
| 7 | +import org.junit.jupiter.api.Test |
| 8 | +import dev.adamko.kxstsgen.util.* |
| 9 | + |
| 10 | +class TuplesTest { |
| 11 | + @Test |
| 12 | + fun testExampleTuple01() { |
| 13 | + captureOutput("ExampleTuple01") { |
| 14 | + dev.adamko.kxstsgen.example.exampleTuple01.main() |
| 15 | + }.normalizeJoin() |
| 16 | + .shouldBe( |
| 17 | + // language=TypeScript |
| 18 | + """ |
| 19 | + |export type SimpleTypes = [string, number, number | null, boolean, string]; |
| 20 | + """.trimMargin() |
| 21 | + .normalize() |
| 22 | + ) |
| 23 | + } |
| 24 | + |
| 25 | + @Test |
| 26 | + fun testExampleTuple02() { |
| 27 | + captureOutput("ExampleTuple02") { |
| 28 | + dev.adamko.kxstsgen.example.exampleTuple02.main() |
| 29 | + }.normalizeJoin() |
| 30 | + .shouldBe( |
| 31 | + // language=TypeScript |
| 32 | + """ |
| 33 | + |export type OptionalFields = [string, string, string | null, string | null]; |
| 34 | + """.trimMargin() |
| 35 | + .normalize() |
| 36 | + ) |
| 37 | + } |
| 38 | + |
| 39 | + @Test |
| 40 | + fun testExampleTuple03() { |
| 41 | + captureOutput("ExampleTuple03") { |
| 42 | + dev.adamko.kxstsgen.example.exampleTuple03.main() |
| 43 | + }.normalizeJoin() |
| 44 | + .shouldBe( |
| 45 | + // language=TypeScript |
| 46 | + """ |
| 47 | + |export type Coordinates = [number, number, number]; |
| 48 | + """.trimMargin() |
| 49 | + .normalize() |
| 50 | + ) |
| 51 | + } |
| 52 | + |
| 53 | + @Test |
| 54 | + fun testExampleTuple04() { |
| 55 | + captureOutput("ExampleTuple04") { |
| 56 | + dev.adamko.kxstsgen.example.exampleTuple04.main() |
| 57 | + }.normalizeJoin() |
| 58 | + .shouldBe( |
| 59 | + // language=TypeScript |
| 60 | + """ |
| 61 | + |export interface GameLocations { |
| 62 | + | homeLocation: Coordinates; |
| 63 | + | allLocations: Coordinates[]; |
| 64 | + | namedLocations: { [key: string]: Coordinates }; |
| 65 | + |} |
| 66 | + | |
| 67 | + |export type Coordinates = [number, number, number]; |
| 68 | + """.trimMargin() |
| 69 | + .normalize() |
| 70 | + ) |
| 71 | + } |
| 72 | +} |
0 commit comments