Skip to content

Commit 9ab022c

Browse files
committed
PR fixes
1 parent cd665f0 commit 9ab022c

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

src/app-check/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ export namespace appCheck {
101101
*/
102102
export interface AppCheckTokenOptions {
103103
/**
104-
* The length of time measured in milliseconds starting from when the server
105-
* mints the token for which the returned FAC token will be valid.
106-
* This value must be in milliseconds and between 30 minutes and 7 days, inclusive.
104+
* The length of time, in milliseconds, for which the App Check token will
105+
* be valid. This value must be between 30 minutes and 7 days, inclusive.
107106
*/
108107
ttlMillis?: number;
109108
}

test/unit/app-check/token-generator.spec.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,22 @@ describe('AppCheckTokenGenerator', () => {
157157
.should.eventually.be.a('string').and.not.be.empty;
158158
});
159159

160-
[[THIRTY_MIN_IN_MS, '1800s'], [THIRTY_MIN_IN_MS + 1, '1800.001000000s'],
161-
[SEVEN_DAYS_IN_MS / 2, '302400s'], [SEVEN_DAYS_IN_MS - 1, '604799.999000000s'], [SEVEN_DAYS_IN_MS, '604800s']]
162-
.forEach((ttl) => {
163-
it('should be fulfilled with a Firebase Custom JWT with a valid custom ttl' + JSON.stringify(ttl[0]), () => {
164-
return tokenGenerator.createCustomToken(APP_ID, { ttlMillis: ttl[0] as number })
165-
.then((token) => {
166-
const decoded = jwt.decode(token) as { [key: string]: any };
167-
168-
expect(decoded['ttl']).to.equal(ttl[1]);
169-
});
170-
});
160+
[
161+
[THIRTY_MIN_IN_MS, '1800s'],
162+
[THIRTY_MIN_IN_MS + 1, '1800.001000000s'],
163+
[SEVEN_DAYS_IN_MS / 2, '302400s'],
164+
[SEVEN_DAYS_IN_MS - 1, '604799.999000000s'],
165+
[SEVEN_DAYS_IN_MS, '604800s']
166+
].forEach((ttl) => {
167+
it('should be fulfilled with a Firebase Custom JWT with a valid custom ttl' + JSON.stringify(ttl[0]), () => {
168+
return tokenGenerator.createCustomToken(APP_ID, { ttlMillis: ttl[0] as number })
169+
.then((token) => {
170+
const decoded = jwt.decode(token) as { [key: string]: any };
171+
172+
expect(decoded['ttl']).to.equal(ttl[1]);
173+
});
171174
});
175+
});
172176

173177
it('should be fulfilled with a JWT with the correct decoded payload', () => {
174178
clock = sinon.useFakeTimers(1000);
@@ -212,8 +216,12 @@ describe('AppCheckTokenGenerator', () => {
212216
});
213217
});
214218

215-
[[1800000.000001, '1800.000000001s'], [1800000.001, '1800.000000999s'], [172800000, '172800s'],
216-
[604799999, '604799.999000000s'], [604800000, '604800s']
219+
[
220+
[1800000.000001, '1800.000000001s'],
221+
[1800000.001, '1800.000000999s'],
222+
[172800000, '172800s'],
223+
[604799999, '604799.999000000s'],
224+
[604800000, '604800s']
217225
].forEach((ttl) => {
218226
it('should be fulfilled with a JWT with custom ttl in decoded payload', () => {
219227
clock = sinon.useFakeTimers(1000);

0 commit comments

Comments
 (0)