Skip to content

Commit 13f473d

Browse files
committed
remove testAuthTokenProvider because we don't really use its functionality
1 parent 661a662 commit 13f473d

File tree

4 files changed

+1
-64
lines changed

4 files changed

+1
-64
lines changed

packages/app-types/index.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Provider } from '@firebase/component';
2-
31
/**
42
* @license
53
* Copyright 2017 Google Inc.

packages/database/src/core/Repo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class Repo {
8484
public app: FirebaseApp,
8585
authProvider: Provider<FirebaseAuthInternal>
8686
) {
87-
const authTokenProvider = new AuthTokenProvider(app);
87+
const authTokenProvider = new AuthTokenProvider(app, authProvider);
8888

8989
this.stats_ = StatsManager.getCollection(repoInfo_);
9090

packages/database/test/browser/crawler_support.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { forceRestClient } from '../../src/api/test_access';
2020

2121
import {
2222
getRandomNode,
23-
testAuthTokenProvider,
2423
getFreshRepoFromReference
2524
} from '../helpers/util';
2625

@@ -29,7 +28,6 @@ describe('Crawler Support', function() {
2928
let initialData;
3029
let normalRef;
3130
let restRef;
32-
let tokenProvider;
3331

3432
beforeEach(function(done) {
3533
normalRef = getRandomNode();
@@ -38,15 +36,9 @@ describe('Crawler Support', function() {
3836
restRef = getFreshRepoFromReference(normalRef);
3937
forceRestClient(false);
4038

41-
// tokenProvider = testAuthTokenProvider(restRef.database.app);
42-
4339
setInitialData(done);
4440
});
4541

46-
afterEach(function() {
47-
// tokenProvider.setToken(null);
48-
});
49-
5042
function setInitialData(done) {
5143
// Set some initial data.
5244
initialData = {

packages/database/test/helpers/util.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -140,59 +140,6 @@ export function shuffle(arr, randFn = Math.random) {
140140
}
141141
}
142142

143-
export function testAuthTokenProvider(app) {
144-
let token_ = null;
145-
let nextToken_ = null;
146-
let hasNextToken_ = false;
147-
const listeners_ = [];
148-
149-
app['INTERNAL'] = app['INTERNAL'] || {};
150-
151-
app['INTERNAL']['getToken'] = function(forceRefresh) {
152-
if (forceRefresh && hasNextToken_) {
153-
token_ = nextToken_;
154-
hasNextToken_ = false;
155-
}
156-
return Promise.resolve({ accessToken: token_ });
157-
};
158-
159-
app['INTERNAL']['addAuthTokenListener'] = function(listener) {
160-
const token = token_;
161-
listeners_.push(listener);
162-
const async = Promise.resolve();
163-
async.then(function() {
164-
listener(token);
165-
});
166-
};
167-
168-
app['INTERNAL']['removeAuthTokenListener'] = function(listener) {
169-
throw Error('removeAuthTokenListener not supported in testing');
170-
};
171-
172-
return {
173-
setToken: function(token) {
174-
token_ = token;
175-
const async = Promise.resolve();
176-
for (let i = 0; i < listeners_.length; i++) {
177-
async.then(
178-
(function(idx) {
179-
return function() {
180-
listeners_[idx](token);
181-
};
182-
})(i)
183-
);
184-
}
185-
186-
// Any future thens are guaranteed to be resolved after the listeners have been notified
187-
return async;
188-
},
189-
setNextToken: function(token) {
190-
nextToken_ = token;
191-
hasNextToken_ = true;
192-
}
193-
};
194-
}
195-
196143
let freshRepoId = 1;
197144
const activeFreshApps = [];
198145

0 commit comments

Comments
 (0)