-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #341 from concord-consortium/create-legacy-google-…
…provider Created LegacyGoogleDriveProvider [PT-186571871]
- Loading branch information
Showing
2 changed files
with
709 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CloudFileManagerClient } from "../client" | ||
import LegacyGoogleDriveProvider from "./legacy-google-drive-provider" | ||
|
||
describe('LegacyGoogleDriveProvider', () => { | ||
|
||
const clientId = 'mockClientId' | ||
const apiKey = 'mockApiKey' | ||
|
||
const client = new CloudFileManagerClient() | ||
|
||
it('should throw exception without credentials', () => { | ||
expect(() => new LegacyGoogleDriveProvider({} as any, client)).toThrow() | ||
expect(() => new LegacyGoogleDriveProvider({ clientId } as any, client)).toThrow() | ||
expect(() => new LegacyGoogleDriveProvider({ apiKey } as any, client)).toThrow() | ||
expect(() => new LegacyGoogleDriveProvider({ clientId, apiKey }, client)).not.toThrow() | ||
}) | ||
|
||
it('should load the google API only once', () => { | ||
const provider = new LegacyGoogleDriveProvider({ clientId, apiKey }, client) | ||
const promise1 = LegacyGoogleDriveProvider.apiLoadPromise | ||
const promise2 = provider.waitForAPILoad() | ||
expect(promise1).toBe(promise2) | ||
const promise3 = provider.waitForAPILoad() | ||
expect(promise1).toBe(promise3) | ||
expect(promise2).toBe(promise3) | ||
}) | ||
|
||
}) |
Oops, something went wrong.