@@ -22,7 +22,15 @@ import {
22
22
PrebuildSettings ,
23
23
WorkspaceSettings ,
24
24
} from "@gitpod/public-api/lib/gitpod/v1/configuration_pb" ;
25
- import { AuthProviderEntry , AuthProviderInfo , ProjectEnvVar , UserEnvVarValue , WithEnvvarsContext } from "./protocol" ;
25
+ import {
26
+ AuthProviderEntry ,
27
+ AuthProviderInfo ,
28
+ ProjectEnvVar ,
29
+ SuggestedRepository ,
30
+ Token ,
31
+ UserEnvVarValue ,
32
+ WithEnvvarsContext ,
33
+ } from "./protocol" ;
26
34
import {
27
35
AuthProvider ,
28
36
AuthProviderDescription ,
@@ -951,4 +959,43 @@ describe("PublicAPIConverter", () => {
951
959
} ) ;
952
960
} ) ;
953
961
} ) ;
962
+ describe ( "toSCMToken" , ( ) => {
963
+ it ( "should convert a token" , ( ) => {
964
+ const t1 = new Date ( ) ;
965
+ const token : Token = {
966
+ scopes : [ "foo" ] ,
967
+ value : "secret" ,
968
+ refreshToken : "refresh!" ,
969
+ username : "root" ,
970
+ idToken : "nope" ,
971
+ expiryDate : t1 . toISOString ( ) ,
972
+ updateDate : t1 . toISOString ( ) ,
973
+ } ;
974
+ expect ( converter . toSCMToken ( token ) . toJson ( ) ) . to . deep . equal ( {
975
+ expiryDate : t1 . toISOString ( ) ,
976
+ idToken : "nope" ,
977
+ refreshToken : "refresh!" ,
978
+ scopes : [ "foo" ] ,
979
+ updateDate : t1 . toISOString ( ) ,
980
+ username : "root" ,
981
+ value : "secret" ,
982
+ } ) ;
983
+ } ) ;
984
+ } ) ;
985
+ describe ( "toSuggestedRepository" , ( ) => {
986
+ it ( "should convert a repo" , ( ) => {
987
+ const repo : SuggestedRepository = {
988
+ url : "https://github.com/gitpod-io/gitpod" ,
989
+ projectId : "123" ,
990
+ projectName : "Gitpod" ,
991
+ repositoryName : "gitpod" ,
992
+ } ;
993
+ expect ( converter . toSuggestedRepository ( repo ) . toJson ( ) ) . to . deep . equal ( {
994
+ url : "https://github.com/gitpod-io/gitpod" ,
995
+ configurationId : "123" ,
996
+ configurationName : "Gitpod" ,
997
+ repoName : "gitpod" ,
998
+ } ) ;
999
+ } ) ;
1000
+ } ) ;
954
1001
} ) ;
0 commit comments