Skip to content

Commit

Permalink
Merge pull request #341 from concord-consortium/create-legacy-google-…
Browse files Browse the repository at this point in the history
…provider

Created LegacyGoogleDriveProvider [PT-186571871]
  • Loading branch information
dougmartin authored Dec 7, 2023
2 parents d0fef7e + e73f6cf commit 445a307
Show file tree
Hide file tree
Showing 2 changed files with 709 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/code/providers/legacy-google-drive-provider.test.ts
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)
})

})
Loading

0 comments on commit 445a307

Please sign in to comment.