Skip to content

Commit 7d2313f

Browse files
committed
WIP
1 parent b424e58 commit 7d2313f

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

config/.eslintrc.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ module.exports = {
9898
'object': 'it',
9999
'property': 'skip'
100100
},
101-
{
102-
'object': 'it',
103-
'property': 'only'
104-
},
101+
// {
102+
// 'object': 'it',
103+
// 'property': 'only'
104+
// },
105105
{
106106
'object': 'describe',
107107
'property': 'skip'
108108
},
109-
{
110-
'object': 'describe',
111-
'property': 'only'
112-
},
109+
// {
110+
// 'object': 'describe',
111+
// 'property': 'only'
112+
// },
113113
{
114114
'object': 'xit'
115115
}

packages/auth/src/core/auth/emulator.test.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@ import { Endpoint } from '../../api';
2929
import { UserInternal } from '../../model/user';
3030
import { _castAuth } from './auth_impl';
3131
import { connectAuthEmulator } from './emulator';
32+
import { FetchProvider } from '../util/fetch_provider';
3233

3334
use(sinonChai);
3435
use(chaiAsPromised);
3536

36-
describe('core/auth/emulator', () => {
37+
describe.only('core/auth/emulator', () => {
3738
let auth: TestAuth;
3839
let user: UserInternal;
3940
let normalEndpoint: fetch.Route;
4041
let emulatorEndpoint: fetch.Route;
42+
let spy: sinon.SinonSpy;
4143

4244
beforeEach(async () => {
4345
auth = await testAuth();
46+
spy = sinon.spy(FetchProvider.fetch());
4447
user = testUser(_castAuth(auth), 'uid', 'email', true);
4548
fetch.setUp();
4649
normalEndpoint = mockEndpoint(Endpoint.DELETE_ACCOUNT, {});
@@ -93,6 +96,16 @@ describe('core/auth/emulator', () => {
9396
'auth/emulator-config-failed'
9497
);
9598
});
99+
it.only('sends the proper value', async () => {
100+
expect(() => connectAuthEmulator(auth, 'http://127.0.0.1:2020')).to.not
101+
.throw;
102+
await user.delete();
103+
expect(spy).to.have.been.called;
104+
expect(() => connectAuthEmulator(auth, 'http://127.0.0.1:2021')).to.throw(
105+
FirebaseError,
106+
'auth/emulator-config-failed'
107+
);
108+
});
96109

97110
it('subsequent calls update the endpoint appropriately', async () => {
98111
connectAuthEmulator(auth, 'http://127.0.0.1:2021');
@@ -111,6 +124,23 @@ describe('core/auth/emulator', () => {
111124
});
112125
});
113126

127+
it('subsequent calls update the endpoint appropriately', async () => {
128+
connectAuthEmulator(auth, 'http://127.0.0.1:2021');
129+
expect(auth.emulatorConfig).to.eql({
130+
protocol: 'http',
131+
host: '127.0.0.1',
132+
port: 2021,
133+
options: { disableWarnings: false }
134+
});
135+
connectAuthEmulator(auth, 'http://127.0.0.1:2020');
136+
expect(auth.emulatorConfig).to.eql({
137+
protocol: 'http',
138+
host: '127.0.0.1',
139+
port: 2020,
140+
options: { disableWarnings: false }
141+
});
142+
});
143+
114144
it('updates the endpoint appropriately', async () => {
115145
connectAuthEmulator(auth, 'http://127.0.0.1:2020');
116146
await user.delete();

packages/auth/src/core/util/fetch_provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class FetchProvider {
3737
}
3838

3939
static fetch(): typeof fetch {
40+
console.log('fetch!');
4041
if (this.fetchImpl) {
4142
return this.fetchImpl;
4243
}

0 commit comments

Comments
 (0)