File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed
packages/data-connect/test/unit
scripts/emulator-testing/emulators Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,11 @@ import chaiAsPromised from 'chai-as-promised';
22
22
import * as sinon from 'sinon' ;
23
23
24
24
import {
25
- AuthTokenListener ,
26
- AuthTokenProvider ,
27
25
DataConnectOptions
28
26
} from '../../src' ;
29
27
import { initializeFetch } from '../../src/network/fetch' ;
30
28
import { RESTTransport } from '../../src/network/transport/rest' ;
29
+ import { AuthTokenListener , AuthTokenProvider } from '../../src/core/FirebaseAuthProvider' ;
31
30
chai . use ( chaiAsPromised ) ;
32
31
const options : DataConnectOptions = {
33
32
connector : 'c' ,
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
+ import { platform } from 'os' ;
18
19
import { Emulator } from './emulator' ;
19
20
20
21
const DATABASE_EMULATOR_VERSION = '1.1.17' ;
21
22
22
23
export class DataConnectEmulator extends Emulator {
23
24
// namespace: string;
24
25
25
- constructor ( port = 3628 , namespace = 'test-emulator' ) {
26
+ constructor ( port = 3628 ) {
27
+ const os = platform ( ) ;
28
+ let urlString = '' ;
29
+ switch ( os ) {
30
+ case 'darwin' :
31
+ urlString = 'https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/emulator%2Fdataconnect-emulator-macos-v1.3.5?alt=media&token=52c3db6e-2a2a-4094-a482-a8c85ae67a88' ;
32
+ break ;
33
+ case 'linux' :
34
+ urlString = 'https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/emulator%2Fdataconnect-emulator-linux-v1.3.5?alt=media&token=bafb1f81-2a27-4851-b655-59934985b492' ;
35
+ break ;
36
+ case 'win32' :
37
+ urlString = 'https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/emulator%2Fdataconnect-emulator-windows-v1.3.5?alt=media&token=d3d04c57-992f-4a4b-931d-5c90efd54c5a' ;
38
+ break ;
39
+ default :
40
+ throw new Error ( `We are unable to support your environment ${ os } at this time.` ) ;
41
+
42
+
43
+ }
26
44
super (
27
45
`cli-v${ DATABASE_EMULATOR_VERSION } ` ,
28
46
// Use locked version of emulator for test to be deterministic.
29
47
// The latest version can be found from database emulator doc:
30
48
// https://firebase.google.com/docs/database/security/test-rules-emulator
31
- `https://firebasestorage.googleapis.com/v0/b/firemat-preview-drop/o/emulator%2Fdataconnect-emulator-macos-v1.1.17?alt=media&token=c5e758bc-aaad-4be6-bd41-bcc08f3944a7` ,
49
+ urlString ,
32
50
port
33
51
) ;
34
- this . isJar = false ;
35
- // this.namespace = namespace;
52
+ this . isDataConnect = true ;
36
53
}
37
54
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export abstract class Emulator {
36
36
cacheDirectory : string ;
37
37
cacheBinaryPath : string ;
38
38
39
- isJar = true ;
39
+ isDataConnect = false ;
40
40
41
41
constructor (
42
42
private binaryName : string ,
@@ -96,7 +96,7 @@ export abstract class Emulator {
96
96
throw new Error ( 'You must call download() before setUp()' ) ;
97
97
}
98
98
let promise : ChildProcessPromise < SpawnPromiseResult > ;
99
- if ( ! this . isJar ) {
99
+ if ( this . isDataConnect ) {
100
100
promise = spawn ( this . binaryPath , [
101
101
'dev' ,
102
102
'--local_connection_string' ,
You can’t perform that action at this time.
0 commit comments