Skip to content

Commit 60040c7

Browse files
committed
Formatting
1 parent 27f837c commit 60040c7

File tree

2 files changed

+64
-23
lines changed

2 files changed

+64
-23
lines changed

packages-exp/auth-exp/scripts/run-node-tests.js

+55-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
/**
33
* @license
44
* Copyright 2020 Google LLC
@@ -14,4 +14,57 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*/var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};exports.__esModule=true;var path_1=require("path");var child_process_promise_1=require("child-process-promise");var yargs=require("yargs");var argv=yargs.options({local:{type:"boolean"},integration:{type:"boolean"}}).argv;var nyc=path_1.resolve(__dirname,"../../../node_modules/.bin/nyc");var mocha=path_1.resolve(__dirname,"../../../node_modules/.bin/mocha");process.env.TS_NODE_COMPILER_OPTIONS='{"module":"commonjs"}';var testConfig=["src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts","--file","index.node.ts"];if(argv.integration){testConfig=["test/integration/flows/{email,anonymous}.test.ts"];if(argv.local){testConfig.push("test/integration/flows/*.local.test.ts")}}var args=__spreadArrays(["--reporter","lcovonly",mocha],testConfig,["--config","../../config/mocharc.node.js"]);if(argv.local){process.env.AUTH_EMULATOR_PORT="9099";process.env.AUTH_EMULATOR_PROJECT_ID="test-emulator"}args=args.concat(argv._);var childProcess=child_process_promise_1.spawn(nyc,args,{stdio:"inherit",cwd:process.cwd()}).childProcess;process.once("exit",(function(){return childProcess.kill()}));process.once("SIGINT",(function(){return childProcess.kill("SIGINT")}));process.once("SIGTERM",(function(){return childProcess.kill("SIGTERM")}));
17+
*/ var __spreadArrays =
18+
(this && this.__spreadArrays) ||
19+
function () {
20+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
21+
s += arguments[i].length;
22+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
23+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
24+
r[k] = a[j];
25+
return r;
26+
};
27+
exports.__esModule = true;
28+
var path_1 = require('path');
29+
var child_process_promise_1 = require('child-process-promise');
30+
var yargs = require('yargs');
31+
var argv = yargs.options({
32+
local: { type: 'boolean' },
33+
integration: { type: 'boolean' }
34+
}).argv;
35+
var nyc = path_1.resolve(__dirname, '../../../node_modules/.bin/nyc');
36+
var mocha = path_1.resolve(__dirname, '../../../node_modules/.bin/mocha');
37+
process.env.TS_NODE_COMPILER_OPTIONS = '{"module":"commonjs"}';
38+
var testConfig = [
39+
'src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts',
40+
'--file',
41+
'index.node.ts'
42+
];
43+
if (argv.integration) {
44+
testConfig = ['test/integration/flows/{email,anonymous}.test.ts'];
45+
if (argv.local) {
46+
testConfig.push('test/integration/flows/*.local.test.ts');
47+
}
48+
}
49+
var args = __spreadArrays(['--reporter', 'lcovonly', mocha], testConfig, [
50+
'--config',
51+
'../../config/mocharc.node.js'
52+
]);
53+
if (argv.local) {
54+
process.env.AUTH_EMULATOR_PORT = '9099';
55+
process.env.AUTH_EMULATOR_PROJECT_ID = 'test-emulator';
56+
}
57+
args = args.concat(argv._);
58+
var childProcess = child_process_promise_1.spawn(nyc, args, {
59+
stdio: 'inherit',
60+
cwd: process.cwd()
61+
}).childProcess;
62+
process.once('exit', function () {
63+
return childProcess.kill();
64+
});
65+
process.once('SIGINT', function () {
66+
return childProcess.kill('SIGINT');
67+
});
68+
process.once('SIGTERM', function () {
69+
return childProcess.kill('SIGTERM');
70+
});

packages-exp/auth-exp/test/integration/flows/custom.local.test.ts

+9-21
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import {
2727
signInWithEmailAndPassword,
2828
updateEmail,
2929
updatePassword,
30-
updateProfile,
31-
// eslint-disable-next-line import/no-extraneous-dependencies
30+
updateProfile
31+
// eslint-disable-next-line import/no-extraneous-dependencies
3232
} from '@firebase/auth-exp';
3333
import { FirebaseError } from '@firebase/util';
3434
import { expect, use } from 'chai';
@@ -52,7 +52,7 @@ describe('Integration test: custom auth', () => {
5252
customToken = JSON.stringify({
5353
uid,
5454
claims: {
55-
customClaim: 'some-claim',
55+
customClaim: 'some-claim'
5656
}
5757
});
5858

@@ -66,10 +66,7 @@ describe('Integration test: custom auth', () => {
6666
});
6767

6868
it('signs in with custom token', async () => {
69-
const cred = await signInWithCustomToken(
70-
auth,
71-
customToken
72-
);
69+
const cred = await signInWithCustomToken(auth, customToken);
7370
expect(auth.currentUser).to.eq(cred.user);
7471
expect(cred.operationType).to.eq(OperationType.SIGN_IN);
7572

@@ -97,11 +94,8 @@ describe('Integration test: custom auth', () => {
9794
});
9895

9996
it('allows the user to delete the account', async () => {
100-
let { user } = await signInWithCustomToken(
101-
auth,
102-
customToken
103-
);
104-
await updateProfile(user, {displayName: 'Display Name'});
97+
let { user } = await signInWithCustomToken(auth, customToken);
98+
await updateProfile(user, { displayName: 'Display Name' });
10599
expect(user.displayName).to.eq('Display Name');
106100

107101
await user.delete();
@@ -111,20 +105,14 @@ describe('Integration test: custom auth', () => {
111105
);
112106
expect(auth.currentUser).to.be.null;
113107

114-
({user} = await signInWithCustomToken(auth, customToken));
108+
({ user } = await signInWithCustomToken(auth, customToken));
115109
// New user in the system: the display name should be missing
116110
expect(user.displayName).to.be.null;
117111
});
118112

119113
it('sign in can be called twice successively', async () => {
120-
const { user: userA } = await signInWithCustomToken(
121-
auth,
122-
customToken
123-
);
124-
const { user: userB } = await signInWithCustomToken(
125-
auth,
126-
customToken
127-
);
114+
const { user: userA } = await signInWithCustomToken(auth, customToken);
115+
const { user: userB } = await signInWithCustomToken(auth, customToken);
128116
expect(userA.uid).to.eq(userB.uid);
129117
});
130118

0 commit comments

Comments
 (0)