Files
react-native-firebase/packages/database/e2e/helpers.js
Mike Diarmid fe959bb842 [v6] Implement Realtime Database (#2195)
* [database] recreate database branch based off of #2185

* [database] cleanup linting issues

* [database] enable tests

* [database] add to tests deps
2019-06-04 15:25:35 +01:00

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;