forked from NangoHQ/nango
-
Notifications
You must be signed in to change notification settings - Fork 0
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 NangoHQ#40 from Bearer/fix/make-proxy-request-work…
…-correctly Fix/make proxy request work correctly
- Loading branch information
Showing
18 changed files
with
330 additions
and
445 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"javascript.format.enable": false, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
} |
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 @@ | ||
{} |
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,4 @@ | ||
version: '3' | ||
services: | ||
database: | ||
image: postgres |
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
This file was deleted.
Oops, something went wrong.
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,76 @@ | ||
import Pizzly from '../src/index' | ||
|
||
describe('Connect', () => { | ||
beforeAll(() => { | ||
window.addEventListener = jest.fn() | ||
// @ts-ignore | ||
window.open = jest.fn(() => { | ||
return { closed: false } | ||
}) | ||
}) | ||
|
||
const publishableKey = 'foo' | ||
const integration = 'github' | ||
|
||
function setup() { | ||
return new Pizzly(publishableKey) | ||
} | ||
|
||
describe('connect', () => { | ||
it('is a function', () => { | ||
const pizzly = setup() | ||
|
||
expect(pizzly.connect).toBeInstanceOf(Function) | ||
}) | ||
|
||
it('accepts an integration argument', () => { | ||
const pizzly = setup() | ||
|
||
expect(pizzly.connect(integration)).toBeInstanceOf(Promise) | ||
}) | ||
|
||
it('must have an integration argument', () => { | ||
const pizzly = setup() | ||
expect(() => { | ||
// @ts-expect-error | ||
return pizzly.connect() | ||
}).toThrowError() | ||
}) | ||
|
||
it('accepts an (optional) options argument', () => { | ||
const pizzly = setup() | ||
|
||
expect(pizzly.connect(integration, {})).toBeInstanceOf(Promise) | ||
}) | ||
}) | ||
|
||
it('opens a popup (window modal)', () => { | ||
const pizzly = setup() | ||
expect.assertions(1) | ||
|
||
pizzly.connect(integration).catch() | ||
|
||
expect(window.open).toHaveBeenCalled() | ||
}) | ||
|
||
// More tests to add on that: | ||
// - it opens a popup with this URL | ||
// - it opens a popup with this size | ||
// - it opens a popup with this position | ||
|
||
it('listens to message', () => { | ||
const pizzly = setup() | ||
expect.assertions(1) | ||
|
||
pizzly.connect(integration).catch() | ||
|
||
expect(window.addEventListener).toHaveBeenCalledWith('message', expect.any(Function), false) | ||
}) | ||
|
||
describe('Return values', () => { | ||
// More test to add here: | ||
// it returns a promise | ||
// it returns an object on promise.resolve | ||
// it returns an error on promise.reject | ||
}) | ||
}) |
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
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
22 changes: 0 additions & 22 deletions
22
src/legacy/auth/v3/strategies/__snapshots__/api-key.test.ts.snap
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
src/legacy/auth/v3/strategies/__snapshots__/basic.test.ts.snap
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/legacy/functions/__snapshots__/lambda-request.test.ts.snap
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.