mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
JS: add test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
| tst.js:5:1:5:22 | fb.data ... ef('x') |
|
||||
| tst.js:7:3:7:7 | x.ref |
|
||||
| tst.js:7:3:7:14 | x.ref.parent |
|
||||
| tst.js:10:1:10:25 | admin.d ... ef('x') |
|
||||
| tst.js:12:3:12:7 | x.ref |
|
||||
| tst.js:12:3:12:14 | x.ref.parent |
|
||||
| tst.js:17:3:17:7 | x.ref |
|
||||
| tst.js:17:3:17:14 | x.ref.parent |
|
||||
| tst.js:23:3:23:7 | x.ref |
|
||||
| tst.js:23:3:23:14 | x.ref.parent |
|
||||
| tst.js:32:12:32:42 | this.fi ... .ref(x) |
|
||||
| tst.js:46:12:46:42 | this.fi ... .ref(x) |
|
||||
| tst.js:50:12:50:25 | this.getRef(x) |
|
||||
| tst.js:50:12:50:34 | this.ge ... hild(x) |
|
||||
| tst.js:54:5:54:37 | this.fi ... ef('x') |
|
||||
| tst.js:58:1:58:61 | new Fir ... /news') |
|
||||
| tst.js:59:1:59:38 | new Fir ... /news') |
|
||||
@@ -0,0 +1,3 @@
|
||||
import javascript
|
||||
|
||||
select Firebase::Database::ref()
|
||||
@@ -0,0 +1,10 @@
|
||||
| tst.js:5:1:8:2 | fb.data ... ent;\\n}) |
|
||||
| tst.js:5:38:5:38 | x |
|
||||
| tst.js:10:1:13:2 | admin.d ... ent;\\n}) |
|
||||
| tst.js:10:41:10:41 | x |
|
||||
| tst.js:15:38:15:38 | x |
|
||||
| tst.js:20:38:20:38 | x |
|
||||
| tst.js:21:3:21:10 | x.before |
|
||||
| tst.js:22:3:22:9 | x.after |
|
||||
| tst.js:50:12:50:48 | this.ge ... value') |
|
||||
| tst.js:60:1:60:39 | new Fir ... em('x') |
|
||||
@@ -0,0 +1,3 @@
|
||||
import javascript
|
||||
|
||||
select Firebase::snapshot()
|
||||
@@ -0,0 +1,6 @@
|
||||
| tst.js:6:3:6:9 | x.val() |
|
||||
| tst.js:11:3:11:9 | x.val() |
|
||||
| tst.js:16:3:16:9 | x.val() |
|
||||
| tst.js:21:3:21:16 | x.before.val() |
|
||||
| tst.js:22:3:22:15 | x.after.val() |
|
||||
| tst.js:61:36:61:36 | x |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from Firebase::FirebaseVal val
|
||||
select val
|
||||
70
javascript/ql/test/library-tests/frameworks/Firebase/tst.js
Normal file
70
javascript/ql/test/library-tests/frameworks/Firebase/tst.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import * as fb from 'firebase/app';
|
||||
import * as admin from 'firebase-admin';
|
||||
import * as functions from 'firebase-functions';
|
||||
|
||||
fb.database().ref('x').once('value', x => {
|
||||
x.val();
|
||||
x.ref.parent;
|
||||
});
|
||||
|
||||
admin.database().ref('x').once('value', x => {
|
||||
x.val();
|
||||
x.ref.parent;
|
||||
});
|
||||
|
||||
functions.database.ref('x').onCreate(x => {
|
||||
x.val();
|
||||
x.ref.parent;
|
||||
});
|
||||
|
||||
functions.database.ref('x').onUpdate(x => {
|
||||
x.before.val();
|
||||
x.after.val();
|
||||
x.ref.parent;
|
||||
});
|
||||
|
||||
class FirebaseWrapper {
|
||||
constructor(firebase) {
|
||||
this.firebase = firebase;
|
||||
}
|
||||
|
||||
getRef(x) {
|
||||
return this.firebase.database().ref(x);
|
||||
}
|
||||
}
|
||||
|
||||
class FirebaseWrapper2 {
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.firebase = fb.initializeApp();
|
||||
}
|
||||
|
||||
getRef(x) {
|
||||
return this.firebase.database().ref(x);
|
||||
}
|
||||
|
||||
getNewsItem(x) {
|
||||
return this.getRef(x).child(x).once('value');
|
||||
}
|
||||
|
||||
adjustValue(fn) {
|
||||
this.firebase.database().ref('x').transaction(fn);
|
||||
}
|
||||
}
|
||||
|
||||
new FirebaseWrapper(firebase.initializeApp()).getRef('/news');
|
||||
new FirebaseWrapper2().getRef('/news');
|
||||
new FirebaseWrapper2().getNewsItem('x');
|
||||
new FirebaseWrapper2().adjustValue(x => x + 1);
|
||||
|
||||
class Box {
|
||||
constructor(x) {
|
||||
this.x = x;
|
||||
}
|
||||
}
|
||||
let box1 = new Box(fb.database());
|
||||
let box2 = new Box(whatever());
|
||||
box2.x.ref(); // not a firebase ref
|
||||
Reference in New Issue
Block a user