ReactJs testing useEffect hook with enzyme

Reactjs testing with enzyme doesn’t work with new React hook like useEffect, you need to: Mock useEffect hook with: jest.spyOn Use React.useEffect instead of import { useEffect } from 'react' component.js export default function YourComponent() { const [data, setData] = useState(null) React.useEffect(() => { YourService.yourfunction() .then(data => setData(data)) }, []) return ( <Table/> ) } component.test.js import { shallow } from "enzyme" describe("<YourComponent>", () => { let wrapper beforeEach(() => { // given YourService.

How to configure lombok and mapstruct with Gradle

I created a new Kotlin project and want to import my old project. Old configuration My new Kotlin project was configured to use Mapstruct and the build.gradle look like apply plugin: 'kotlin-kapt' dependencies { implementation "org.mapstruct:mapstruct:${mapstructVersion}" kapt "org.mapstruct:mapstruct-processor:${mapstructVersion}" } When I want to use lombok for the java project. I added the dependencies but it doesn’t work. implementation "org.projectlombok:lombok:${lombokVersion}" annotationProcessor "org.projectlombok:lombok:${lombokVersion}" The ./gradlew build just give the error of no Getter/Setter found, that means lombok was not processing when build.

CodeceptJS attachFile

Today I try to select the file for upload using CodeceptJS WebdriverIO helper. I.attachFile(‘fieldName’, ‘path/file’); My expectation is that the file input field will be filled with the file path but it wasn’t. I try to debug by add the log to the helper configuration in codecept.json “logLevel”: “verbose”, “logOutput”: “test/output”, Then I see the command was trigger, but what it did is upload the file directly to the web server.

Git save local changes without commit

Often, when you’ve been working on part of your project, things are in a messy state and you want to switch branches for a bit to work on something else. The problem is, you don’t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is the git stash command. Stashing takes the dirty state of your working directory – that is, your modified tracked files and staged changes – and saves it on a stack of unfinished changes that you can reapply at any time.

Stone Wall

You are going to build a stone wall. The wall should be straight and N meters long, and its thickness should be constant; however, it should have different heights in different places. The height of the wall is specified by a zero-indexed array H of N positive integers. H[I] is the height of the wall from I to I+1 meters to the right of its left end. In particular, H[0] is the height of the wall’s left end and H[N−1] is the height of the wall’s right end.