Skip to content

Commit

Permalink
add test for toUser
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Dec 4, 2023
1 parent 471386e commit 996e47a
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 1 deletion.
75 changes: 75 additions & 0 deletions components/public-api/typescript-common/fixtures/toUser_1.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"result": {
"id": "007a807f-f2a7-436b-a77f-66ed11ee7828",
"organizationId": "6f5b2707-c83f-4e04-a37c-23d1b1d385ae",
"name": "Gitpod Tester",
"avatarUrl": "https://avatars.githubusercontent.com/u/37021919?v=4",
"createdAt": "2023-12-04T08:54:31.686Z",
"identities": [
{
"authProviderId": "Public-GitHub",
"authId": "37021919",
"authName": "GitpodTester",
"primaryEmail": "[email protected]"
}
],
"blocked": false,
"lastVerificationTime": "2023-12-04T08:54:31.700Z",
"verificationPhoneNumber": "+49150-111111111",
"workspaceTimeoutSettings": {
"inactivity": "3600s",
"disabledDisconnected": true
},
"emailNotificationSettings": {
"allowsChangelogMail": true,
"allowsDevxMail": true,
"allowsOnboardingMail": true
},
"editorSettings": {
"name": "code",
"version": "latest"
},
"dotfileRepo": "https://github.com/gitpod-samples/demo-dotfiles-with-gitpod",
"workspaceClass": "XXXL",
"profile": {
"lastUpdatedDetailsNudge": "2023-12-04T08:54:34.831Z",
"acceptedPrivacyPolicyDate": "2023-12-04T08:54:31.700Z",
"companyName": "",
"emailAddress": "[email protected]",
"jobRole": "other",
"jobRoleOther": "",
"explorationReasons": [
"replace-remote-dev",
"replace-remote-dev"
],
"signupGoals": [
"other",
"other"
],
"signupGoalsOther": "",
"onboardedTimestamp": "2023-12-04T08:54:41.326Z",
"companySize": ""
},
"workspaceAutostartOptions": [
{
"cloneUrl": "https://github.com/gitpod-io/gitpod",
"organizationId": "6f5b2707-c83f-4e04-a37c-23d1b1d385ae",
"workspaceClass": "XXXL",
"editorSettings": {
"name": "code",
"version": "stable"
},
"region": ""
}
],
"usageAttributionId": "",
"workspaceFeatureFlags": [
"USER_FEATURE_FLAG_FULL_WORKSPACE_BACKUP"
],
"rolesOrPermissions": [
"ROLE_OR_PERMISSION_ADMIN",
"ROLE_OR_PERMISSION_DEVELOPER"
]
},
"err": ""
}
84 changes: 84 additions & 0 deletions components/public-api/typescript-common/fixtures/toUser_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"id": "007a807f-f2a7-436b-a77f-66ed11ee7828",
"creationDate": "2023-12-04T08:54:31.686Z",
"avatarUrl": "https://avatars.githubusercontent.com/u/37021919?v=4",
"name": "GitpodTester",
"fullName": "Gitpod Tester",
"organizationId": "6f5b2707-c83f-4e04-a37c-23d1b1d385ae",
"verificationPhoneNumber": "+49150-111111111",
"blocked": false,
"featureFlags": {
"permanentWSFeatureFlags": [
"full_workspace_backup"
]
},
"rolesOrPermissions": [
"admin",
"developer"
],
"markedDeleted": false,
"noReleasePeriod": false,
"additionalData": {
"emailNotificationSettings": {
"allowsChangelogMail": true,
"allowsDevXMail": true,
"allowsOnboardingMail": true
},
"profile": {
"acceptedPrivacyPolicyDate": "2023-12-04T08:54:31.700Z",
"emailAddress": "[email protected]",
"lastUpdatedDetailsNudge": "2023-12-04T08:54:34.831Z",
"jobRole": "other",
"jobRoleOther": "",
"explorationReasons": [
"replace-remote-dev",
"replace-remote-dev"
],
"signupGoals": [
"other",
"other"
],
"signupGoalsOther": "",
"companySize": "",
"onboardedTimestamp": "2023-12-04T08:54:41.326Z",
"name": "Gitpod Tester",
"email": "[email protected]",
"company": "",
"avatarURL": "https://avatars.githubusercontent.com/u/37021919?v=4"
},
"shouldSeeMigrationMessage": false,
"ideSettings": {
"settingVersion": "2.0",
"defaultIde": "code",
"useLatestVersion": true
},
"workspaceAutostartOptions": [
{
"cloneURL": "https://github.com/gitpod-io/gitpod",
"organizationId": "6f5b2707-c83f-4e04-a37c-23d1b1d385ae",
"ideSettings": {
"defaultIde": "code"
},
"workspaceClass": "XXXL"
}
],
"disabledClosedTimeout": true,
"workspaceTimeout": "1h",
"dotfileRepo": "https://github.com/gitpod-samples/demo-dotfiles-with-gitpod",
"workspaceClasses": {
"regular": "XXXL"
}
},
"lastVerificationTime": "2023-12-04T08:54:31.700Z",
"fgaRelationshipsVersion": 5,
"identities": [
{
"authProviderId": "Public-GitHub",
"authId": "37021919",
"authName": "GitpodTester",
"primaryEmail": "[email protected]",
"deleted": false,
"readonly": false
}
]
}
3 changes: 2 additions & 1 deletion components/public-api/typescript-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"test": "mocha './**/*.spec.js' --exclude './node_modules/**' --exclude './lib/esm/**' --exit",
"test:forceUpdate": "mocha './**/*.spec.js' --exclude './node_modules/**' --exclude './lib/esm/**' --exit -force -update && yarn format:fixtures",
"test:leeway": "yarn build && yarn test",
"format:fixtures": "git ls-files -- 'fixtures/*' | xargs pre-commit run end-of-file-fixer --files > /dev/null || exit 0"
"format:fixtures": "git ls-files -- 'fixtures/*' | xargs pre-commit run end-of-file-fixer --files > /dev/null || exit 0",
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput"
},
"dependencies": {
"@bufbuild/protobuf": "^1.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ describe("PublicAPIConverter", () => {
const converter = new PublicAPIConverter();

describe("golden tests", () => {
it.only("toUser", async () => {
await startFixtureTest("../fixtures/toUser_*.json", async (input) => converter.toUser(input));
});

it("toOrganization", async () => {
await startFixtureTest("../fixtures/toOrganization_*.json", async (input) =>
converter.toOrganization(input),
Expand Down

0 comments on commit 996e47a

Please sign in to comment.