forked from passportxyz/passport
-
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.
* feat: allow list stamp * feat: verify allow list from scorer * app: wip dynamic provider * feat(app): normalize custom provider at global level * feat: update to address list and build provider config within app from weights * feat: verifying allow list * chore: rename back to allowList * feat: update remaining functionality to match custom providers * feat: hide allow list if you don't have points * chore: remove unneeded updates * chore(platforms): fix allowlist test * fix: non custom dashboard bugs * feat: test allow list providers * chore: use is_member * feat: show allow list within cardlist * chore: provide errors for allowList stamp * fix: non error handling
- Loading branch information
1 parent
1812b01
commit ec2d21b
Showing
32 changed files
with
666 additions
and
241 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
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
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,67 @@ | ||
import { PLATFORM_ID } from "@gitcoin/passport-types"; | ||
import { Providers, customStampProviders, getStampProviderIds } from "../../config/providers"; | ||
import { DynamicCustomization } from "../../utils/customizationUtils"; | ||
import { Provider } from "ethers"; | ||
|
||
jest.mock("@gitcoin/passport-platforms", () => ({ | ||
platforms: [], | ||
})); | ||
|
||
const STAMP_PROVIDERS = { | ||
Signer: [ | ||
{ | ||
platformGroup: "Account Name", | ||
providers: [{ title: "Encrypted", name: "Signer" }], | ||
}, | ||
], | ||
}; | ||
|
||
const CUSTOM_PROVIDERS = { | ||
AllowList: [{ providers: [{ name: "AllowList#test" }] }], | ||
}; | ||
|
||
describe("customStampProviders", () => { | ||
it("returns default providers if customization is undefined", () => { | ||
const result = customStampProviders(); | ||
expect(result).toMatchObject(STAMP_PROVIDERS); | ||
}); | ||
|
||
it("returns default providers if customization does not have allowListProviders", () => { | ||
const customization = { otherField: "value" } as unknown as DynamicCustomization; | ||
const result = customStampProviders(customization); | ||
expect(result).toEqual(STAMP_PROVIDERS); | ||
}); | ||
|
||
it("returns custom providers if customization contains allowListProviders", () => { | ||
const customization = { allowListProviders: CUSTOM_PROVIDERS.AllowList } as unknown as DynamicCustomization; | ||
const result = customStampProviders(customization); | ||
expect(result.AllowList).toEqual(CUSTOM_PROVIDERS.AllowList); | ||
}); | ||
}); | ||
|
||
describe("getStampProviderIds", () => { | ||
it("returns an empty array if no providers are available for the given platform", () => { | ||
const providers = { Signer: [] } as unknown as Providers; | ||
const result = getStampProviderIds("E" as PLATFORM_ID, providers); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
it("returns an array of provider IDs for the given platform", () => { | ||
const providers = { | ||
Default: [{ providers: [{ name: "ProviderOne" }, { name: "ProviderTwo" }] }], | ||
} as unknown as Providers; | ||
const result = getStampProviderIds("Default" as PLATFORM_ID, providers); | ||
expect(result).toEqual(["ProviderOne", "ProviderTwo"]); | ||
}); | ||
|
||
it("handles platforms with multiple provider groups", () => { | ||
const providers = { | ||
ComplexPlatform: [ | ||
{ providers: [{ name: "FirstGroupProvider" }] }, | ||
{ providers: [{ name: "SecondGroupProvider" }] }, | ||
], | ||
} as unknown as Providers; | ||
const result = getStampProviderIds("ComplexPlatform" as PLATFORM_ID, providers); | ||
expect(result).toEqual(["FirstGroupProvider", "SecondGroupProvider"]); | ||
}); | ||
}); |
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
Oops, something went wrong.