Skip to content

[Auto] Add unit tests for craftd-core#110

Closed
rviannaoliveira wants to merge 12 commits intomainfrom
cover/test-7
Closed

[Auto] Add unit tests for craftd-core#110
rviannaoliveira wants to merge 12 commits intomainfrom
cover/test-7

Conversation

@rviannaoliveira
Copy link
Copy Markdown
Contributor

Auto-generated Unit Tests

Este PR foi gerado automaticamente pelo workflow Auto Generate Cover+Test usando a Claude API.

Evolução de cobertura

Arquivos Cobertura
Antes 17 / 19 89%
Depois 19 / 19 100%

Arquivos cobertos

ViewMapperVoTest.kt,ActionPropertiesTest.kt AnalyticsPropertiesTest.kt,TextPropertiesTest.kt ImagePropertiesTest.kt,ButtonPropertiesTest.kt StylePropertiesTest.kt,CheckBoxPropertiesTest.kt SimplePropertiesTest.kt,SimplePropertiesResponseTest.kt ViewMapperTest.kt,ContextExtesionTest.kt StringExtensionsTest.kt,CraftDComponentKeyTest.kt CraftDViewListenerTest.kt,CraftDAlignTest.kt CraftDTextStyleTest.kt,CraftDContentScaleTest.kt CraftDSimplePropertiesDiffCallbackTest.kt

Como funciona

  1. Um PR tocou arquivos em android_kmp/craftd-core
  2. Após o CI passar, o workflow escaneou todos os arquivos sem cobertura
  3. Claude gerou testes JUnit4 + MockK para cada arquivo
  4. Este PR foi criado automaticamente com o resultado

Checklist de revisão

  • Testes compilam sem erros (./gradlew testDebugUnitTest)
  • Testes cobrem os principais caminhos de lógica
  • Edge cases tratados (null, vazio, JSON inválido)

Triggered by PR #103

rviannaoliveira and others added 12 commits April 11, 2026 20:09
- Add IMAGE_COMPONENT to CraftDComponentKey enum
- Add CraftDContentScale enum (CROP, FIT, FILL_BOUNDS, FILL_WIDTH, FILL_HEIGHT, INSIDE, NONE)
- Add ImageProperties data class with url, contentScale, contentDescription, actionProperties

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Compose:
- Add toContentScale() extension mapping CraftDContentScale → ContentScale
- Add CraftDImage composable with injectable imageLoader lambda
- Add CraftDImageBuilder with injectable imageLoader constructor param

XML:
- Add CraftDImageComponent (AppCompatImageView wrapper)
- Add CraftDImageComponentRender with injectable imageLoader
- Register CraftDImageComponentRender in CraftDBuilderManager via optional imageLoader param

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Unit tests for ImageProperties serialization, toContentScale() and CraftDImageBuilder key
- Updated docs/how-to-use/compose.md and view-system.md with CraftDImage usage examples
- Registered CraftDImageBuilder (Coil) in Compose sample and CraftDImageComponentRender (Picasso) in XML sample
- Added CraftDImage entry to dynamic.json
- Switched app-sample-android to local craftd-xml project dependency
- Added Coil 2.6.0 to libs.versions.toml
- Deleted notes.md after context consumed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge changes from main (unit tests, build-logic updates) into the feature branch.
Resolved conflicts in CraftDComponentKeyTest (IMAGE_COMPONENT count) and
CraftDContentScale (removed Compose annotations from commonMain).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ns from commonMain

- Add ContentScale param to imageLoader lambda in CraftDImage and CraftDImageBuilder
  so the server-driven contentScale is actually applied when loading images
- Map CraftDContentScale to ImageView.ScaleType in CraftDImageComponentRender (XML)
- Remove @Stable/@immutable from ImageProperties (androidx.compose deps in commonMain)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Archive empty add-craftd-image change (2026-04-22)
- Update tasks.md in 2026-04-13-add-craftd-image-android-kmp:
  - 1.4: remove @Stable/@immutable from ImageProperties (commonMain violation)
  - 2.2a: imageLoader lambda now includes ContentScale param
  - 3.2a: contentScale mapped to ImageView.scaleType in XML render
  - 4.3: correct description of what tests actually cover
  - 4.4: pending tests task for next propose

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Register CraftDImageBuilder with Coil 3 (KMP-compatible) AsyncImage in the
CMP sample, mirroring the android sample setup. Adds coil3-compose to
commonMain and coil3-network-okhttp to androidMain for network image loading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ KOTLIN detekt yes 196 no 5.02s
⚠️ MARKDOWN markdown-table-formatter 46 1 0 0.24s
⚠️ YAML prettier 18 1 4 0.8s

See detailed report in MegaLinter reports

You could have the same capabilities but better runtime performances if you use a MegaLinter flavor:

MegaLinter is graciously provided by OX Security

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant