test: fix flaky Apple Game Center tests (#8204)

This commit is contained in:
dblythy
2022-10-01 20:14:59 +10:00
committed by GitHub
parent 5376c3b145
commit eb649f226f
2 changed files with 45 additions and 1 deletions

View File

@@ -1705,6 +1705,7 @@ describe('Apple Game Center Auth adapter', () => {
const gcenter = require('../lib/Adapters/Auth/gcenter');
const fs = require('fs');
const testCert = fs.readFileSync(__dirname + '/support/cert/game_center.pem');
const testCert2 = fs.readFileSync(__dirname + '/support/cert/game_center.pem');
it('can load adapter', async () => {
const options = {
@@ -1756,6 +1757,7 @@ describe('Apple Game Center Auth adapter', () => {
it('validateAuthData invalid signature id', async () => {
gcenter.cache['https://static.gc.apple.com/public-key/gc-prod-4.cer'] = testCert;
gcenter.cache['https://static.gc.apple.com/public-key/gc-prod-6.cer'] = testCert2;
const { adapter, appIds, providerOptions } = authenticationLoader.loadAuthAdapter(
'gcenter',
{}
@@ -1867,7 +1869,7 @@ describe('Apple Game Center Auth adapter', () => {
);
const duration = new Date().getTime() - previous.getTime();
expect(duration).toEqual(0);
expect(duration <= 1).toBe(true);
});
it('adapter should throw', async () => {