mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-10 10:00:28 +08:00
* [database] recreate database branch based off of #2185 * [database] cleanup linting issues * [database] enable tests * [database] add to tests deps
55 lines
855 B
JavaScript
55 lines
855 B
JavaScript
// TODO make more unique?
|
|
const ID = Date.now();
|
|
|
|
const PATH = `tests/${ID}`;
|
|
|
|
const CONTENT = {
|
|
TYPES: {
|
|
array: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
boolean: true,
|
|
string: 'foobar',
|
|
number: 123567890,
|
|
object: {
|
|
foo: 'bar',
|
|
bar: 'baz',
|
|
},
|
|
},
|
|
QUERY: {
|
|
a: {
|
|
string: 'foo',
|
|
number: 10,
|
|
},
|
|
b: {
|
|
string: 'bar',
|
|
number: 5,
|
|
},
|
|
c: {
|
|
string: 'baz',
|
|
number: 8,
|
|
},
|
|
},
|
|
};
|
|
|
|
exports.seed = function seed(path) {
|
|
return Promise.all([
|
|
firebase
|
|
.database()
|
|
.ref(`${path}/types`)
|
|
.set(CONTENT.TYPES),
|
|
firebase
|
|
.database()
|
|
.ref(`${path}/query`)
|
|
.set(CONTENT.QUERY),
|
|
]);
|
|
};
|
|
|
|
exports.wipe = function wipe(path) {
|
|
return firebase
|
|
.database()
|
|
.ref(path)
|
|
.remove();
|
|
};
|
|
|
|
exports.PATH = PATH;
|
|
exports.CONTENT = CONTENT;
|