Skip to content

Commit ad4dd78

Browse files
authored
3367 sunset ceramic integration (#3385)
* feat: removing ceramic integration * feat: removing ceramic integration * feat: removing ceramic integration * feat: remove tests for compose DB * feat: remove ceramic icon in footer * fix: move testing library to the dev dependencies
1 parent 100b5e2 commit ad4dd78

23 files changed

+24
-2123
lines changed

.github/workflows/build_and_deploy_production.yml

-13
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ jobs:
5757
export-env: true
5858
env:
5959
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
60-
CERAMIC_PRIVATE_KEY: op://DevOps/passport-xyz-production-secrets/ci/CERAMIC_PRIVATE_KEY
61-
# - name: Deploy Ceramic Models
62-
# working-directory: ./schemas
63-
# run: yarn models:deploy-composite
64-
# env:
65-
# CERAMIC_URL: http://localhost:7007
66-
# PRIVATE_KEY: ${{env.CERAMIC_PRIVATE_KEY}}
67-
# - name: Run Ceramic Integration Tests
68-
# run: yarn test:ceramic-integration
69-
# env:
70-
# CERAMIC_CLIENT_URL: http://localhost:7007
71-
# IAM_JWK: '{"kty":"OKP","crv":"Ed25519","x":"a7wbszn1DfZ3I7-_zDkUXCgypcGxL_cpCSTYEPRYj_o","d":"Z0hucmxRt1C22ygAXJ1arXwD9QlAA5tEPLb7qoXYDGY"}'
72-
# IAM_JWK_EIP712: '{"kty":"EC","crv":"secp256k1","x":"PdB2nS-knyAxc6KPuxBr65vRpW-duAXwpeXlwGJ03eU","y":"MwoGZ08hF5uv-_UEC9BKsYdJVSbJNHcFhR1BZWer5RQ","d":"z9VrSNNZXf9ywUx3v_8cLDhSw8-pvAT9qu_WZmqqfWM"}'
7360

7461
check-provider-bitmap:
7562
name: Check Provider Bitmaps

.github/workflows/build_and_deploy_review.yml

-13
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@ jobs:
5959
export-env: true
6060
env:
6161
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
62-
CERAMIC_PRIVATE_KEY: op://DevOps/passport-xyz-review-secrets/ci/CERAMIC_PRIVATE_KEY
63-
# - name: Deploy Ceramic Models
64-
# working-directory: ./schemas
65-
# run: yarn models:deploy-composite
66-
# env:
67-
# CERAMIC_URL: http://localhost:7007
68-
# PRIVATE_KEY: ${{env.CERAMIC_PRIVATE_KEY}}
69-
# - name: Run Ceramic Integration Tests
70-
# run: yarn test:ceramic-integration
71-
# env:
72-
# CERAMIC_CLIENT_URL: http://localhost:7007
73-
# IAM_JWK: '{"kty":"OKP","crv":"Ed25519","x":"a7wbszn1DfZ3I7-_zDkUXCgypcGxL_cpCSTYEPRYj_o","d":"Z0hucmxRt1C22ygAXJ1arXwD9QlAA5tEPLb7qoXYDGY"}'
74-
# IAM_JWK_EIP712: '{"kty":"EC","crv":"secp256k1","x":"PdB2nS-knyAxc6KPuxBr65vRpW-duAXwpeXlwGJ03eU","y":"MwoGZ08hF5uv-_UEC9BKsYdJVSbJNHcFhR1BZWer5RQ","d":"z9VrSNNZXf9ywUx3v_8cLDhSw8-pvAT9qu_WZmqqfWM"}'
7562

7663
deploy-api:
7764
needs: [ref, run-tests]

.github/workflows/build_and_deploy_staging.yml

-13
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ jobs:
5757
export-env: true
5858
env:
5959
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
60-
CERAMIC_PRIVATE_KEY: op://DevOps/passport-xyz-staging-secrets/ci/CERAMIC_PRIVATE_KEY
61-
# - name: Deploy Ceramic Models
62-
# working-directory: ./schemas
63-
# run: yarn models:deploy-composite
64-
# env:
65-
# CERAMIC_URL: http://localhost:7007
66-
# PRIVATE_KEY: ${{env.CERAMIC_PRIVATE_KEY}}
67-
# - name: Run Ceramic Integration Tests
68-
# run: yarn test:ceramic-integration
69-
# env:
70-
# CERAMIC_CLIENT_URL: http://localhost:7007
71-
# IAM_JWK: '{"kty":"OKP","crv":"Ed25519","x":"a7wbszn1DfZ3I7-_zDkUXCgypcGxL_cpCSTYEPRYj_o","d":"Z0hucmxRt1C22ygAXJ1arXwD9QlAA5tEPLb7qoXYDGY"}'
72-
# IAM_JWK_EIP712: '{"kty":"EC","crv":"secp256k1","x":"PdB2nS-knyAxc6KPuxBr65vRpW-duAXwpeXlwGJ03eU","y":"MwoGZ08hF5uv-_UEC9BKsYdJVSbJNHcFhR1BZWer5RQ","d":"z9VrSNNZXf9ywUx3v_8cLDhSw8-pvAT9qu_WZmqqfWM"}'
7360

7461
check-provider-bitmap:
7562
name: Check Provider Bitmaps

.github/workflows/ci.yml

-13
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ jobs:
4444
export-env: true
4545
env:
4646
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
47-
CERAMIC_PRIVATE_KEY: op://DevOps/passport-xyz-review-secrets/ci/CERAMIC_PRIVATE_KEY
48-
# - name: Deploy Ceramic Models
49-
# working-directory: ./schemas
50-
# run: yarn models:deploy-composite
51-
# env:
52-
# CERAMIC_URL: http://localhost:7007
53-
# PRIVATE_KEY: ${{env.CERAMIC_PRIVATE_KEY}}
54-
# - name: Run Ceramic Integration Tests
55-
# run: yarn test:ceramic-integration
56-
# env:
57-
# CERAMIC_CLIENT_URL: http://localhost:7007
58-
# IAM_JWK: '{"kty":"OKP","crv":"Ed25519","x":"a7wbszn1DfZ3I7-_zDkUXCgypcGxL_cpCSTYEPRYj_o","d":"Z0hucmxRt1C22ygAXJ1arXwD9QlAA5tEPLb7qoXYDGY"}'
59-
# IAM_JWK_EIP712: '{"kty":"EC","crv":"secp256k1","x":"PdB2nS-knyAxc6KPuxBr65vRpW-duAXwpeXlwGJ03eU","y":"MwoGZ08hF5uv-_UEC9BKsYdJVSbJNHcFhR1BZWer5RQ","d":"z9VrSNNZXf9ywUx3v_8cLDhSw8-pvAT9qu_WZmqqfWM"}'
6047

6148
check-provider-bitmap:
6249
name: Check Provider Bitmaps

.husky/pre-push

-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@
66
# - tests are run in CI
77
# yarn lint
88
# yarn run test
9-
# yarn run test:ceramic-integration
10-
# disabled integration test May 30 2023
11-
# it was causing too many errors and is
12-
# addressed during build anyway <3MSG

app/__test-fixtures__/contextTestHelpers.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export const makeTestCeramicContext = (initialState?: Partial<CeramicContextStat
102102
handlePatchStamps: vi.fn(),
103103
handleCreatePassport: vi.fn(),
104104
handleDeleteStamps: vi.fn(),
105-
handleComposeRetry: vi.fn(),
106105
expiredProviders: [],
107106
expiredPlatforms: {},
108107
passportHasCacaoError: false,

app/__tests__/context/ceramicContext.test.tsx

+13-196
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import {
55
CeramicContextProvider,
66
CeramicContextState,
77
cleanPassport,
8-
getStampsToRetry,
98
} from "../../context/ceramicContext";
10-
import { ComposeDatabase, PassportDatabase } from "@gitcoin/passport-database-client";
9+
import { PassportDatabase } from "@gitcoin/passport-database-client";
1110
import { useEffect } from "react";
1211
import {
1312
googleStampFixture,
@@ -696,20 +695,8 @@ const passportDbMocks = {
696695
did: "test-user-did",
697696
};
698697

699-
const ceramicDbMocks = {
700-
createPassport: dbCreatePassportMock,
701-
getPassport: dbGetPassportMock,
702-
addStamp: dbAddStampMock,
703-
addStamps: dbAddStampsMock,
704-
deleteStamp: dbDeleteStampMock,
705-
deleteStamps: dbDeleteStampsMock,
706-
patchStamps: vi.fn(),
707-
did: "test-user-did",
708-
};
709-
710698
vi.mock("@gitcoin/passport-database-client", () => {
711699
return {
712-
ComposeDatabase: vi.fn().mockImplementation(() => ceramicDbMocks),
713700
PassportDatabase: vi.fn().mockImplementation(() => passportDbMocks),
714701
};
715702
});
@@ -765,20 +752,6 @@ describe("CeramicContextProvider", () => {
765752
}),
766753
} as any;
767754
});
768-
vi.mocked(ComposeDatabase).mockImplementation(() => {
769-
return {
770-
...ceramicDbMocks,
771-
getPassport: vi.fn().mockImplementation(async () => {
772-
return {
773-
passport: {
774-
stamps: composeStamps,
775-
},
776-
errorDetails: {},
777-
status: "Success",
778-
};
779-
}),
780-
} as any;
781-
});
782755

783756
const Component = () => {
784757
useEffect(() => {
@@ -813,9 +786,7 @@ describe("CeramicContextProvider", () => {
813786
});
814787

815788
describe("CeramicContextProvider syncs stamp state with ceramic", () => {
816-
beforeEach(() => {
817-
vi.mocked(ComposeDatabase).mockImplementation(() => ceramicDbMocks as any);
818-
});
789+
beforeEach(() => {});
819790

820791
it("should return passport and stamps after successful fetch", async () => {
821792
vi.mocked(PassportDatabase).mockImplementation(() => {
@@ -902,83 +873,13 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
902873
}),
903874
} as any;
904875
});
905-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
906-
return {
907-
...ceramicDbMocks,
908-
getPassport: vi.fn().mockImplementation(async () => {
909-
return {
910-
passport: {
911-
stamps,
912-
},
913-
errorDetails: {},
914-
status: "Success",
915-
};
916-
}),
917-
} as any;
918-
});
876+
919877
render(mockComponent());
920878

921879
await waitFor(() => expect(screen.getAllByText("# Stamps = 3")).toHaveLength(1));
922880
});
923881

924-
it("should attempt to add stamps to database and ceramic", async () => {
925-
const oldConsoleLog = console.log;
926-
try {
927-
console.log = vi.fn();
928-
929-
const addStampsMock = vi.fn();
930-
const addStampMock = vi.fn().mockRejectedValue(new Error("Error"));
931-
vi.mocked(PassportDatabase).mockImplementationOnce(() => {
932-
return {
933-
...passportDbMocks,
934-
addStamps: addStampsMock.mockImplementationOnce(async () => {
935-
return {
936-
passport: {
937-
stamps,
938-
},
939-
errorDetails: {},
940-
status: "Success",
941-
};
942-
}),
943-
getPassport: vi.fn().mockImplementationOnce(async () => {
944-
return {
945-
passport: {
946-
stamps: [],
947-
},
948-
errorDetails: {},
949-
status: "Success",
950-
};
951-
}),
952-
} as any;
953-
});
954-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
955-
return {
956-
...ceramicDbMocks,
957-
getPassport: vi.fn().mockImplementation(async () => {
958-
return {
959-
passport: {
960-
stamps,
961-
},
962-
errorDetails: {},
963-
status: "Success",
964-
};
965-
}),
966-
addStamps: addStampMock,
967-
} as any;
968-
});
969-
render(mockComponent());
970-
971-
await waitFor(() => fireEvent.click(screen.getByText("handleAddStamps")));
972-
await waitFor(() => {
973-
expect(addStampsMock).toHaveBeenCalled();
974-
expect(addStampMock).toHaveBeenCalledWith(stamps);
975-
expect(console.log).toHaveBeenCalledWith("error adding ceramic stamps", new Error("Error"));
976-
});
977-
} finally {
978-
console.log = oldConsoleLog;
979-
}
980-
});
981-
it("should attempt to delete stamps from database and ceramic", async () => {
882+
it("should attempt to delete stamps from database", async () => {
982883
const oldConsoleLog = console.log;
983884
try {
984885
console.log = vi.fn();
@@ -1006,12 +907,7 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
1006907
}),
1007908
} as any;
1008909
});
1009-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
1010-
return {
1011-
...ceramicDbMocks,
1012-
deleteStamps: deleteStampsMock,
1013-
} as any;
1014-
});
910+
1015911
render(mockComponent());
1016912

1017913
await waitFor(() => fireEvent.click(screen.getByText("handleDeleteStamps")));
@@ -1024,7 +920,7 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
1024920
}
1025921
});
1026922

1027-
it("should patch stamps in database and delete + add stamps in ceramic", async () => {
923+
it("should patch stamps in database", async () => {
1028924
const added = stampPatches.filter(({ credential }) => credential);
1029925

1030926
const patchStampsMock = vi.fn();
@@ -1055,13 +951,6 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
1055951
const setStampMock = vi.fn();
1056952
const deleteStampsMock = vi.fn();
1057953

1058-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
1059-
return {
1060-
...ceramicDbMocks,
1061-
deleteStampIDs: deleteStampsMock,
1062-
} as any;
1063-
});
1064-
1065954
render(mockComponent());
1066955

1067956
await waitFor(() => fireEvent.click(screen.getByText("handlePatchStamps")));
@@ -1070,61 +959,8 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
1070959
});
1071960
});
1072961

1073-
it("should log an error but continue if ceramic patch fails", async () => {
1074-
const oldConsoleLog = console.log;
1075-
try {
1076-
console.log = vi.fn();
1077-
1078-
const patchStampsMock = vi.fn().mockRejectedValue(new Error("Error"));
1079-
vi.mocked(PassportDatabase).mockImplementationOnce(() => {
1080-
return {
1081-
...passportDbMocks,
1082-
patchStamps: patchStampsMock.mockImplementationOnce(async () => {
1083-
return {
1084-
passport: {
1085-
stamps,
1086-
},
1087-
errorDetails: {},
1088-
status: "Success",
1089-
};
1090-
}),
1091-
getPassport: vi.fn().mockImplementationOnce(async () => {
1092-
return {
1093-
passport: {
1094-
stamps,
1095-
},
1096-
errorDetails: {},
1097-
status: "Success",
1098-
};
1099-
}),
1100-
} as any;
1101-
});
1102-
1103-
const setStampMock = vi.fn().mockRejectedValue(new Error("Error"));
1104-
const deleteStampsMock = vi.fn();
1105-
1106-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
1107-
return {
1108-
...ceramicDbMocks,
1109-
setStamps: setStampMock,
1110-
deleteStampIDs: deleteStampsMock,
1111-
patchStamps: patchStampsMock,
1112-
} as any;
1113-
});
1114-
1115-
render(mockComponent());
1116-
1117-
await waitFor(() => fireEvent.click(screen.getByText("handlePatchStamps")));
1118-
await waitFor(() => {
1119-
expect(patchStampsMock).toHaveBeenCalledWith(stampPatches);
1120-
expect(console.log).toHaveBeenCalledWith("error patching ceramic stamps", new Error("Error"));
1121-
});
1122-
} finally {
1123-
console.log = oldConsoleLog;
1124-
}
1125-
});
1126-
1127-
it("should show an error toast but continue if ceramic patch fails due to invalid session", async () => {
962+
it("should patch stamps with PasportDatabase", async () => {
963+
const patchStampsMock = vi.fn().mockRejectedValue(new Error("Error"));
1128964
vi.mocked(PassportDatabase).mockImplementationOnce(() => {
1129965
return {
1130966
...passportDbMocks,
@@ -1149,22 +985,14 @@ describe("CeramicContextProvider syncs stamp state with ceramic", () => {
1149985
} as any;
1150986
});
1151987

1152-
const patchStampsMock = vi.fn();
988+
vi.fn().mockRejectedValue(new Error("Error"));
1153989

1154-
vi.mocked(ComposeDatabase).mockImplementationOnce(() => {
1155-
return {
1156-
...ceramicDbMocks,
1157-
patchStamps: patchStampsMock,
1158-
} as any;
1159-
});
1160-
1161-
render(mockComponent({ invalidSession: true }));
990+
render(mockComponent());
1162991

1163992
await waitFor(() => fireEvent.click(screen.getByText("handlePatchStamps")));
1164-
await waitFor(() => expect(patchStampsMock).toHaveBeenCalledWith(stampPatches));
1165-
await screen.findByText(
1166-
"Your update was not logged to Ceramic. Please refresh the page to reset your Ceramic session."
1167-
);
993+
await waitFor(() => {
994+
expect(patchStampsMock).toHaveBeenCalledWith(stampPatches);
995+
});
1168996
});
1169997
});
1170998

@@ -1220,14 +1048,3 @@ describe("cleanPassport function", () => {
12201048
expect(result.expiredProviders.length).toBe(0);
12211049
});
12221050
});
1223-
1224-
describe("handleComposeRetry function", () => {
1225-
it("should detect a difference between the stamps in the database and the stamps in ceramic", async () => {
1226-
const result = getStampsToRetry(composeStamps, databasePassport.stamps);
1227-
expect(result).toHaveLength(2);
1228-
});
1229-
it("should not return anything if the stamps in the database and the stamps in ceramic are the same", async () => {
1230-
const result = getStampsToRetry(databasePassport.stamps, databasePassport.stamps);
1231-
expect(result).toHaveLength(0);
1232-
});
1233-
});

0 commit comments

Comments
 (0)