![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
A utility library for testing React Native components using Detox
npm install --save-dev kompot
const Kompot = require('kompot');
//require the component that we want to test:
const component = Kompot.kompotRequire('../ChuckNorrisJokesPresenter');
//write some mocks:
component.kompotInjector({
MOCK_LAME_JOKE: () => {
const JokeService = require('../fetchJokeService');
JokeService.fetchJoke = async () => {
return Promise.resolve('This is a lame Chuck Norris joke')
}
}
})
describe('ChuckNorrisJokesPresenter', () => {
it('Should fetch a joke', async () =>
await component
.withProps({someProp: 'test'})
.withMocks(['MOCK_LAME_JOKE']) //use the mock that we specified above
.mount();
await expect(element(by.id('chuckNorisJoke'))).toHaveText('"This is a lame Kompot joke"');
})
});
You should use this method instead of the native require in order to require your component.
const component = Kompot.kompotRequire('../App').App;
See below about the returned component object.
Use this function when you need to mock things.
component.kompotInjector({
default: () => { //the default function will be called for each test.
const JokeService = require('../fetchJokeService');
JokeService.fetchJoke = async () => {
return Promise.resolve('A mocked joke fetched from the joke service!');
}
},
MOCK_LAME_JOKE: () => { //will be called only if the componet is mounting with the 'MOCK_LAME_JOKE' mock.
const JokeService = require('../fetchJokeService');
JokeService.fetchJoke = async () => {
return Promise.resolve('This is a lame Chuck Norris joke')
}
}
})
You can decide which mock will be activated when you are mounting the component with mocks:
component.withMocks(['MOCK_LAME_JOKE']).mount();
The default
mock will be always activated.
When you require a component, you get a component object with the following props:
usage: kompot-cli.js [-h] [-s] [-k] [-r] [-b appName]
[-t {react-native-navigation}] [-i filePath]
[-l filePath]
Optional arguments:
-h, --help Show this help message and exit.
-s, --start Launch react-native's packager.
-k, --kill Kill server and packager if needed.
-r, --run-server Start the Kompot server on port 2600
-b appName, --build appName
Scan the project for *.kompot.spec.js and process
them. app name should be the same name that you pass
to AppRegistry.registerComponent()
-t {react-native-navigation}, --app-type {react-native-navigation}
Application type.
-i filePath, --init-root filePath
A path to an initialization file, for custom
initializaion of the root component.
-l filePath, --load filePath
A path to a file that will be loaded before the
mounting of the component. Put all global mocks in
this file
FAQs
A utility library for testing React Native components using Detox
The npm package kompot receives a total of 3 weekly downloads. As such, kompot popularity was classified as not popular.
We found that kompot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.