mirror of
https://github.com/zhigang1992/firebase-sdk-test-admin-issue.git
synced 2026-01-12 16:32:19 +08:00
chore: init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
*.log
|
||||
13
babel.config.js
Normal file
13
babel.config.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: 'current',
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
11
hello.test.ts
Normal file
11
hello.test.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as firebase from '@firebase/rules-unit-testing';
|
||||
|
||||
beforeEach(() => firebase.clearFirestoreData({projectId: 'hello'}))
|
||||
afterAll(() => Promise.all(firebase.apps().map(a => a.delete())))
|
||||
|
||||
test('hello', () => {
|
||||
const db = firebase.initializeTestApp({projectId: 'hello'}).firestore()
|
||||
const adminDb = firebase.initializeAdminApp({projectId: 'hello'}).firestore()
|
||||
firebase.assertSucceeds(adminDb.collection('sup').add({hello: 'world'}))
|
||||
firebase.assertSucceeds(db.collection('hello').add({hello: 'world'}))
|
||||
})
|
||||
14
package.json
Normal file
14
package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@firebase/rules-unit-testing": "^1.0.5",
|
||||
"@types/jest": "^26.0.14",
|
||||
"babel-jest": "^26.3.0",
|
||||
"jest": "^26.4.2",
|
||||
"typescript": "^4.0.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user