>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found
/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1 | |
const mockData = { | |
something: 'value' | |
}; | |
const mockUseSomething = jest.fn().mockReturnValue({ | |
data: mockData, | |
isLoading: false, | |
isSuccess: true, | |
refetch: () => mockUseSomething |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1 | |
jest.mock('react-query', () => ({ | |
useMutation: jest.fn() | |
})); | |
const mockMutationFn = jest.fn().mockRejectedValue(new Error('Mutation failed')); | |
(useMutation as jest.Mock).mockReturnValue([mockMutationFn, {}]); | |
expect(actionCreatorsModal.setIsError).toHaveBeenCalledWith(true, expect.any(Object)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1 | |
const mockRefetch = jest.fn(); | |
jest.mock('react-query', () => ({ | |
useQuery: jest.fn().mockReturnValue(({ data: { ...MockData }, isLoading: false, isSuccess: true, refetch: () => mockRefetch })) | |
})); | |
// Method 2 | |
const mockRefetch = jest.fn(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dispatch = jest.fn(); | |
const state = { ... }; | |
render( | |
<SomeContext.Provider value={{ state, dispatch }}> | |
<Component /> | |
</SomeContext.Provider> | |
); | |
// Call a button or somtheing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setState = jest.fn(); | |
const useStateSpy = jest.spyOn(React, 'useState'); | |
useStateSpy.mockImplementation(() => [init, setState]); | |
expect(setState).toHaveBeenCalledWith('S'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep (time) { | |
return new Promise((resolve) => setTimeout(resolve, time)); | |
} | |
// Sleep a second | |
sleep(1000).then(() => { | |
// Code to run after | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('Validate the images displayed', () => { | |
cy.get('.v-image__image').each(($el) => { | |
const image = $el.css('background-image').replace('url("', '').replace('")', '') | |
cy.request(image).then((res) => { | |
expect(res.status).to.eql(200); | |
}); | |
}); | |
}); | |
it('Validate the images displayed', () => { |
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found
/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.configuration; | |
import java.io.IOException; | |
import java.nio.file.FileSystems; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.nio.file.WatchEvent; | |
import java.nio.file.WatchKey; | |
import java.nio.file.WatchService; |
NewerOlder