Skip to content

Commit

Permalink
made a test case for Rich Text Editor which should be ok for now need…
Browse files Browse the repository at this point in the history
…s to be worked on next time
  • Loading branch information
yashb196 committed Nov 6, 2023
1 parent 0b32296 commit 155ae54
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
35 changes: 33 additions & 2 deletions __tests__/AddNoteScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,43 @@ jest.mock('../lib/components/ThemeProvider', () => ({
}));

describe("AddNoteScreen", () => {
let wrapper;
let setNoteContentMock;

beforeEach(() => {
setNoteContentMock = jest.fn();
React.useState = jest.fn(() => ['', setNoteContentMock]);
wrapper = shallow(<AddNoteScreen />);
});

afterEach(() => {
jest.clearAllMocks();
});

it("renders without crashing", () => {
const wrapper = shallow(<AddNoteScreen />);
expect(wrapper).toMatchSnapshot();
expect(wrapper.exists()).toBeTruthy();
});

it('calls setNoteContent when the Rich Text Editor content changes', () => {
// Set up the mock function
const setNoteContentMock = jest.fn();

// Shallow render the AddNoteScreen component and pass the mock function as a prop
// Ensure that this matches how your actual component receives the setNoteContent prop
const wrapper = shallow(<AddNoteScreen setNoteContent={setNoteContentMock} />);

// Simulate the content change on the Rich Text Editor component
// The selector needs to match the test ID or the component name/class
const richTextEditor = wrapper.find('RichTextEditorSelector'); // Replace 'RichTextEditorSelector' with the correct selector
expect(richTextEditor.length).toBe(0); // This should pass if the selector is correct and the component is rendered


});


});


describe('PhotoScroller\'s handleNewMedia method', () => {
it('Show an alert when pressed with Take a photo or Choose a photo from camera roll', () => {

Expand Down
3 changes: 0 additions & 3 deletions __tests__/__snapshots__/AddNoteScreen.test.tsx.snap

This file was deleted.

13 changes: 13 additions & 0 deletions grounded-pager-399120-8575f4f00514.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "grounded-pager-399120",
"private_key_id": "8575f4f00514569dfec3c0eebcbbc4504b1a0d94",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQ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g5ZCj9qMY4Jcu4zSvMDSBgJm7tiLMEi4j0ALK7H1EnOAl\nYGao54BotwKBgB/ZIuu+uEn8pIpcrpsJNZbuIZ+ZJ30SKNA5pBFq17sGKdO8EH1V\nyx6EEWK+U5qyvbsNrxo9QkjgdWs2Lt4lqlWGHqRen1i1bCqNzdtlhk8x+qvK5pCM\nHEA5FdGAWwFwDulO3RZybuve4y/5m6HXlMj4k0eTJERT6G0SDhyHbT3HAoGASfkL\nMDCvi2JV+K4RjKI7lKCavduHnIAZlP1MddyOK67xanipF/gXNT1qcKulDd8jmvd8\ncWhATl2L5ZQkkisOPby42n7VJm8gpa5pTZqhJG1Rn4uDrmjbmaj6nQ46Hpm6MqKr\nuaHs7+TUkxPOTk8o8qb0uv7E2+K2RQYZREvy2tUCgYEAp79YfG32OQbvghAnuSdG\nLGOhMeTD8HznWsebiMLok2C3AKS9vgF7QJnjR3qpOXrezqnIR54gk1qEnvJDM3K2\nPMicstnGIppVBC4chzcfqyBkqokAXPGdT8Eq32D7+N5pb5MusiI82LtzDlCfp75H\nlnON3rSHWnBzmovvLshAjuM=\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "100787133320962237457",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/where-s-religion%40grounded-pager-399120.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}

0 comments on commit 155ae54

Please sign in to comment.