mirror of
https://github.com/status-im/react-native.git
synced 2025-02-01 12:15:36 +00:00
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
|
jest.autoMockOff();
|
||
|
|
||
|
const getDependencyConfig = require('../../src/config/android').dependencyConfig;
|
||
|
const mockFs = require('mock-fs');
|
||
|
const mocks = require('../fixtures/android');
|
||
|
const userConfig = {};
|
||
|
|
||
|
describe('android::getDependencyConfig', () => {
|
||
|
|
||
|
beforeAll(() => mockFs({
|
||
|
empty: {},
|
||
|
nested: {
|
||
|
android: {
|
||
|
app: mocks.valid,
|
||
|
},
|
||
|
},
|
||
|
corrupted: {
|
||
|
android: {
|
||
|
app: mocks.corrupted,
|
||
|
},
|
||
|
},
|
||
|
noPackage: {
|
||
|
android: {},
|
||
|
},
|
||
|
}));
|
||
|
|
||
|
it('should return an object with android project configuration', () => {
|
||
|
expect(getDependencyConfig('nested', userConfig)).not.toBe(null);
|
||
|
expect(typeof getDependencyConfig('nested', userConfig)).toBe('object');
|
||
|
});
|
||
|
|
||
|
it('should return `null` if manifest file hasn\'t been found', () => {
|
||
|
expect(getDependencyConfig('empty', userConfig)).toBe(null);
|
||
|
});
|
||
|
|
||
|
it('should return `null` if android project was not found', () => {
|
||
|
expect(getDependencyConfig('empty', userConfig)).toBe(null);
|
||
|
});
|
||
|
|
||
|
it('should return `null` if android project does not contain ReactPackage', () => {
|
||
|
expect(getDependencyConfig('noPackage', userConfig)).toBe(null);
|
||
|
});
|
||
|
|
||
|
it('should return `null` if it can\'t find a packageClassName', () => {
|
||
|
expect(getDependencyConfig('corrupted', userConfig)).toBe(null);
|
||
|
});
|
||
|
|
||
|
afterAll(mockFs.restore);
|
||
|
});
|