2018-09-17 12:43:43 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
|
|
|
* @format
|
|
|
|
*/
|
2018-05-11 19:43:49 +00:00
|
|
|
|
2018-10-18 22:24:15 +00:00
|
|
|
const fs = jest.requireActual('fs');
|
|
|
|
const path = jest.requireActual('path');
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2018-05-11 19:43:49 +00:00
|
|
|
const manifest = fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/AndroidManifest.xml'),
|
|
|
|
);
|
|
|
|
const mainJavaClass = fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/Main.java'),
|
|
|
|
);
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2017-06-29 08:08:47 +00:00
|
|
|
function generateValidFileStructure(classFileName) {
|
|
|
|
return {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
2018-05-11 19:43:49 +00:00
|
|
|
[classFileName]: fs.readFileSync(
|
|
|
|
path.join(__dirname, `./files/${classFileName}`),
|
|
|
|
),
|
2017-06-29 08:08:47 +00:00
|
|
|
},
|
2016-05-20 11:52:08 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-06-29 08:08:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.valid = generateValidFileStructure('ReactPackage.java');
|
|
|
|
|
|
|
|
exports.validKotlin = generateValidFileStructure('ReactPackage.kt');
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2017-06-06 21:11:54 +00:00
|
|
|
exports.userConfigManifest = {
|
|
|
|
src: {
|
|
|
|
main: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
2018-05-11 19:43:49 +00:00
|
|
|
'ReactPackage.java': fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/ReactPackage.java'),
|
|
|
|
),
|
2017-06-06 21:11:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
debug: {
|
2018-05-11 19:43:49 +00:00
|
|
|
'AndroidManifest.xml': fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/AndroidManifest-debug.xml'),
|
|
|
|
),
|
2017-06-06 21:11:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-05-20 11:52:08 +00:00
|
|
|
exports.corrupted = {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.noPackage = {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|