-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subscription): support oidcToken (#865)
Co-authored-by: Benjamin E. Coe <[email protected]> Co-authored-by: Megan Potter <[email protected]>
- Loading branch information
1 parent
cf138ab
commit a786ca0
Showing
3 changed files
with
71 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,53 @@ describe('Subscription', () => { | |
undefined | ||
); | ||
}); | ||
|
||
it('should format oidcToken', () => { | ||
const oidcToken = { | ||
serviceAccount: '[email protected]', | ||
audience: 'audience', | ||
}; | ||
|
||
const metadata = { | ||
oidcToken, | ||
}; | ||
|
||
const formatted = Subscription.formatMetadata_(metadata); | ||
|
||
assert.strictEqual(formatted.pushConfig!.oidcToken, oidcToken); | ||
assert.strictEqual( | ||
(formatted as subby.SubscriptionMetadata).oidcToken, | ||
undefined | ||
); | ||
}); | ||
|
||
it('should format both pushEndpoint and oidcToken', () => { | ||
const pushEndpoint = 'http://noop.com/push'; | ||
|
||
const oidcToken = { | ||
serviceAccount: '[email protected]', | ||
audience: 'audience', | ||
}; | ||
|
||
const metadata = { | ||
pushEndpoint, | ||
oidcToken, | ||
}; | ||
|
||
const formatted = Subscription.formatMetadata_(metadata); | ||
|
||
assert.strictEqual(formatted.pushConfig!.pushEndpoint, pushEndpoint); | ||
assert.strictEqual( | ||
(formatted as subby.SubscriptionMetadata).pushEndpoint, | ||
undefined | ||
); | ||
|
||
assert.strictEqual(formatted.pushConfig!.oidcToken, oidcToken); | ||
assert.strictEqual( | ||
(formatted as subby.SubscriptionMetadata).oidcToken, | ||
undefined | ||
); | ||
}); | ||
}); | ||
|
||
describe('formatName_', () => { | ||
|