Swoosh/app/build.gradle.kts
Claude edb1752cd8
test: add comprehensive TDD unit tests for all business logic (116 tests)
Extracted private functions into testable utilities:
- MobiledocBuilder: shared mobiledoc JSON generation (from ComposerViewModel & PostUploadWorker)
- UrlNormalizer: Ghost URL normalization (from ApiClient)

Test suites (all passing):
- GhostJwtGeneratorTest (9): JWT generation, key parsing, hex decoding, claims validation
- GhostAuthInterceptorTest (4): auth header injection, null key handling, request preservation
- ConvertersTest (18): Room type converter round-trips for PostStatus & QueueStatus enums
- FormatRelativeTimeTest (19): relative time formatting (now/minutes/hours/days/dates)
- MobiledocBuilderTest (27): JSON generation, text escaping, link preview cards, edge cases
- UrlNormalizerTest (15): protocol prefixing, trailing slashes, whitespace, ports
- GhostModelsTest (24): data class defaults, GSON serialization, enum values, pagination

Also fixes compilation issues: HorizontalDivider→Divider, PullToRefreshBox→LinearProgressIndicator,
continue-in-inline-lambda, duplicate XML attribute.

https://claude.ai/code/session_01CpMtDAEfMd14A8MQubMppS
2026-03-18 23:24:49 +00:00

127 lines
4 KiB
Text

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
}
android {
namespace = "com.swoosh.microblog"
compileSdk = 34
defaultConfig {
applicationId = "com.swoosh.microblog"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.8"
}
packaging {
resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" }
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
}
dependencies {
// Compose BOM
val composeBom = platform("androidx.compose:compose-bom:2024.01.00")
implementation(composeBom)
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
// Compose
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-extended")
// Navigation
implementation("androidx.navigation:navigation-compose:2.7.6")
// Retrofit + OkHttp
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
// Coil for image loading
implementation("io.coil-kt:coil-compose:2.5.0")
// Room
implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
// WorkManager
implementation("androidx.work:work-runtime-ktx:2.9.0")
// EncryptedSharedPreferences
implementation("androidx.security:security-crypto:1.1.0-alpha06")
// JWT generation
implementation("io.jsonwebtoken:jjwt-api:0.12.3")
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.12.3")
runtimeOnly("io.jsonwebtoken:jjwt-gson:0.12.3")
// Jsoup for OpenGraph parsing
implementation("org.jsoup:jsoup:1.17.2")
// Testing
testImplementation("junit:junit:4.13.2")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
testImplementation("com.google.code.gson:gson:2.10.1")
testImplementation("io.jsonwebtoken:jjwt-api:0.12.3")
testImplementation("io.jsonwebtoken:jjwt-impl:0.12.3")
testImplementation("io.jsonwebtoken:jjwt-gson:0.12.3")
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
testImplementation("org.robolectric:robolectric:4.11.1")
testImplementation("androidx.test:core:1.5.0")
testImplementation("androidx.test.ext:junit:1.1.5")
testImplementation("androidx.arch.core:core-testing:2.2.0")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(composeBom)
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}