[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74FWHFSHJRZH6Q58270SH4S":3,"skill-same:01M74FWHFSHJRZH6Q58270SH4S":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":27,"updatedAt":28,"install":29,"resources":42},"01M74FWHFSHJRZH6Q58270SH4S","unit-testing-kotlin",null,"Astrumon\u002Fspovishun-skills","Astrumon","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F67917191?v=4","01M74FSGPFMM3XWY2PMSEN8Z2W","Danylo Bidnyk","01M74FSGQ12JX4QM4FEY6NEH6N",0,"MIT","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Funit-testing-kotlin\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"# Unit Testing in Kotlin\n\nYou are an expert in testing Kotlin code using JUnit 5, MockK, and Kotest. You produce clean, readable tests that document behavior and catch regressions.\n\n## Test Structure (AAA Pattern)\n```kotlin\n@Test\nfun `should return user when found by telegram id`() {\n    \u002F\u002F Arrange\n    val telegramId = 123456L\n    val expected = User(id = 1, telegramId = telegramId, username = \"testuser\")\n    every { userRepository.findByTelegramId(telegramId) } returns expected\n\n    \u002F\u002F Act\n    val result = userService.findByTelegramId(telegramId)\n\n    \u002F\u002F Assert\n    assertEquals(expected, result)\n    verify(exactly = 1) { userRepository.findByTelegramId(telegramId) }\n}\n```\n\n## Naming Conventions\n- Use backtick function names: `` `should do X when Y` ``\n- Be descriptive: what is expected and under what condition\n- Group by class: `UserServiceTest`, `GroupRepositoryTest`\n\n## MockK Patterns\n```kotlin\n\u002F\u002F Basic mock\nval repo = mockk\u003CUserRepository>()\nevery { repo.findById(any()) } returns null\n\n\u002F\u002F Verify calls\nverify { repo.save(withArg { it.username == \"john\" }) }\n\n\u002F\u002F Mock suspend functions\ncoEvery { repo.findAsync(any()) } returns user\ncoVerify { repo.findAsync(123L) }\n\n\u002F\u002F Spy on real object\nval service = spyk(UserService(repo))\n```\n\n## Testing Coroutines\n```kotlin\n@Test\nfun `should process notifications asynchronously`() = runTest {\n    \u002F\u002F Use runTest from kotlinx-coroutines-test\n    coEvery { notificationService.send(any()) } returns Unit\n    service.notifyAll(listOf(\"user1\", \"user2\"))\n    coVerify(exactly = 2) { notificationService.send(any()) }\n}\n```\n\n## Rules\n- Always use `runTest { }` for `suspend fun` tests\n- Use `coEvery` \u002F `coVerify` for suspending mocks\n- Test names use backtick format\n- `@BeforeTest` to `clearAllMocks()` between tests\n- No real DB connections in unit tests — use MockImpl repos or H2 for integration tests\n- Test success and failure paths explicitly for result containers\n\n## What to Test\n- Happy path — main use case works correctly\n- Edge cases — empty input, null, boundary values\n- Error cases — exceptions are thrown\u002Fhandled correctly\n- Behavior — verify interactions with dependencies\n\n## What NOT to Test\n- Private methods directly — test through public API\n- Framework code — trust the library\n- Trivial getters\u002Fsetters — no business logic = no test needed\n- DI container wiring, bot entry point, `DatabaseFactory`\n",{},"main","4ad702b3d4f403306c1a016277020693dd669f55","skills\u002Funit-testing-kotlin","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills","https:\u002F\u002Fgithub.com\u002FAstrumon","Software Engineer","2026-10-14 01:01:46",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add Astrumon\u002Fspovishun-skills --skill unit-testing-kotlin",{"tool":35,"command":36},"bunx","bunx skills add Astrumon\u002Fspovishun-skills --skill unit-testing-kotlin",{"tool":38,"command":39},"pnpm","pnpm dlx skills add Astrumon\u002Fspovishun-skills --skill unit-testing-kotlin","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Funit-testing-kotlin\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"manifest.yaml","REFERENCE","参考文档",503,"https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Funit-testing-kotlin\u002Fmanifest.yaml",[50,56,62,69,74,79],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":18},"01M74FX71JH2KNG5KX7TZHSKCB","universal-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Funiversal-skill\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M74FX57GTEFPJVCPWPSP6CCW","notion-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Fnotion-skill\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":18},"01M74FX30F3K8906P5ASQ3DNXR","inline-frontmatter-skill","Hand-authored description that already lives in the body and must not be double-wrapped.","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource\u002Fskills\u002Finline-frontmatter-skill\u002FSKILL.md",[],[],{"skillNo":70,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M74FX18AGHM2KHQ502PMJZRJ","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource-v2\u002Fskills\u002Funiversal-skill\u002FSKILL.md",[],[],{"skillNo":75,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M74FWZJ193G810P0ZJ1PKEZ9","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fsource-v2\u002Fskills\u002Fnotion-skill\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M74FWPNEZWWGQ2Q37N6MMWP1","write-a-skill","https:\u002F\u002Fgithub.com\u002FAstrumon\u002Fspovishun-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[],[]]