|
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | 15 | import * as base64js from 'base64-js'; |
16 | | -import {assert} from 'chai'; |
| 16 | +import {strict as assert} from 'assert'; |
17 | 17 | import * as sinon from 'sinon'; |
18 | 18 | import {privateKey, publicKey} from './fixtures/keys'; |
19 | 19 | import {it, describe, beforeEach} from 'mocha'; |
@@ -89,8 +89,8 @@ describe('Browser OAuth2 tests', () => { |
89 | 89 | client.transporter.request = stub; |
90 | 90 | const response = await client.getToken('code here'); |
91 | 91 | const tokens = response.tokens; |
92 | | - assert.isAbove(tokens!.expiry_date!, now + 10 * 1000); |
93 | | - assert.isBelow(tokens!.expiry_date!, now + 15 * 1000); |
| 92 | + assert(tokens!.expiry_date! > now + 10 * 1000); |
| 93 | + assert(tokens!.expiry_date! < now + 15 * 1000); |
94 | 94 | }); |
95 | 95 |
|
96 | 96 | it('getFederatedSignonCerts talks to correct endpoint', async () => { |
@@ -135,7 +135,7 @@ describe('Browser OAuth2 tests', () => { |
135 | 135 | assert.strictEqual(params.get('code_challenge'), codes.codeChallenge); |
136 | 136 | assert.strictEqual( |
137 | 137 | params.get('code_challenge_method'), |
138 | | - CodeChallengeMethod.S256 |
| 138 | + CodeChallengeMethod.S256, |
139 | 139 | ); |
140 | 140 | }); |
141 | 141 |
|
@@ -167,25 +167,23 @@ describe('Browser OAuth2 tests', () => { |
167 | 167 | name: 'RSASSA-PKCS1-v1_5', |
168 | 168 | hash: {name: 'SHA-256'}, |
169 | 169 | }; |
170 | | - // eslint-disable-next-line no-undef |
171 | 170 | const cryptoKey = await window.crypto.subtle.importKey( |
172 | 171 | 'jwk', |
173 | 172 | privateKey, |
174 | 173 | algo, |
175 | 174 | true, |
176 | | - ['sign'] |
| 175 | + ['sign'], |
177 | 176 | ); |
178 | | - // eslint-disable-next-line no-undef |
179 | 177 | const signature = await window.crypto.subtle.sign( |
180 | 178 | algo, |
181 | 179 | cryptoKey, |
182 | | - new TextEncoder().encode(data) |
| 180 | + new TextEncoder().encode(data), |
183 | 181 | ); |
184 | 182 | data += '.' + base64js.fromByteArray(new Uint8Array(signature)); |
185 | 183 | const login = await client.verifySignedJwtWithCertsAsync( |
186 | 184 | data, |
187 | 185 | {keyid: publicKey}, |
188 | | - 'testaudience' |
| 186 | + 'testaudience', |
189 | 187 | ); |
190 | 188 | assert.strictEqual(login.getUserId(), '123456789'); |
191 | 189 | }); |
|
0 commit comments