Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
matbusby-fw committed Dec 19, 2024
1 parent 95f27b2 commit 2431487
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 140 deletions.
2 changes: 1 addition & 1 deletion services/common/src/redux/reducers/partiesReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as actionTypes from "@mds/common/constants/actionTypes";
import { PARTIES } from "@mds/common/constants/reducerTypes";
import { createItemMap, createItemIdsArray } from "../utils/helpers";
import { RootState } from "@mds/common/redux/rootState";
import { IParty, ItemMap, IPartyAppt, IPageData, IAddPartyFormState, IOption } from "@mds/common";
import { IParty, ItemMap, IPartyAppt, IPageData, IAddPartyFormState, IOption } from "@mds/common/interfaces";

/**
* @file partiesReducer.js
Expand Down
40 changes: 40 additions & 0 deletions services/core-api/tests/users/resources/test_user_list_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pytest
import json

from tests.factories import UserFactory


def test_get_users_list_with_search_term(test_client, db_session, auth_headers):
"""Test retrieving a list of users matching a search term."""
# Create a batch of users
UserFactory.create_batch(size=3)

# Create a specific user we want to match with the search term
user_to_match = UserFactory(given_name="SpecificName", family_name="Match")

# Send a GET request with the search term
search_term = "SpecificName"
get_resp = test_client.get(f'/users?search_term={search_term}', headers=auth_headers['full_auth_header'])
get_data = json.loads(get_resp.data.decode())

# Assert the status code and results
assert get_resp.status_code == 200, get_resp.response
assert len(get_data) == 1
assert get_data[0]['given_name'] == user_to_match.given_name
assert get_data[0]['family_name'] == user_to_match.family_name
assert get_data[0]['email'] == user_to_match.email


def test_get_users_list_no_results_found(test_client, db_session, auth_headers):
"""Test retrieving an empty list when no users match the search term."""
# Create a batch of users
UserFactory.create_batch(size=5)

# Send a GET request with a search term that doesn't match any users
search_term = "NonMatchingSearch"
get_resp = test_client.get(f'/users?search_term={search_term}', headers=auth_headers['full_auth_header'])
get_data = json.loads(get_resp.data.decode())

# Assert the status code and empty results
assert get_resp.status_code == 200, get_resp.response
assert len(get_data) == 0
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ beforeEach(() => {

describe("PermitAmendmentForm", () => {
it("renders properly", () => {
const component = shallow(<PermitAmendmentForm {...dispatchProps} {...props} />);
const component = shallow(
<PermitAmendmentForm
{...dispatchProps}
{...props}
handleRemovePermitAmendmentDocument={jest.fn()}
/>
);
expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ beforeEach(() => {

describe("BondForm", () => {
it("renders properly", () => {
const component = shallow(<BondForm {...dispatchProps} {...props} />);
const component = shallow(<BondForm {...dispatchProps} {...props} onSubmit={jest.fn()} />);
expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ exports[`BondForm renders properly 1`] = `
<FormItem
hasFeedback={false}
>
<Connect(PartySelectField)
<PartySelectField
allowAddingParties={true}
id="payer_party_guid"
initialValues={Object {}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`AddPartyRelationshipForm renders properly 1`] = `
<FormItem
hasFeedback={false}
>
<Connect(PartySelectField)
<PartySelectField
allowAddingParties={true}
id="party_guid"
name="party_guid"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AddPermitForm renders properly 1`] = `
<Form
colon={true}
hideRequiredMark={false}
<ForwardRef(InternalForm)
layout="vertical"
onSubmit={[MockFunction]}
>
Expand All @@ -15,25 +13,19 @@ exports[`AddPermitForm renders properly 1`] = `
md={12}
sm={24}
>
<FormItem
hasFeedback={false}
>
<Connect(PartySelectField)
allowAddingParties={true}
id="permittee_party_guid"
label="Permittee*"
name="permittee_party_guid"
partyLabel="permittee"
validate={
Array [
[Function],
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
<PartySelectField
allowAddingParties={true}
id="permittee_party_guid"
label="Permittee*"
name="permittee_party_guid"
partyLabel="permittee"
validate={
Array [
[Function],
]
}
/>
<InternalFormItem>
<Field
component={[Function]}
data={
Expand Down Expand Up @@ -71,10 +63,8 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
</InternalFormItem>
<InternalFormItem>
<Field
component={[Function]}
id="permit_no"
Expand All @@ -88,10 +78,8 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
</InternalFormItem>
<InternalFormItem>
<Field
component={[Function]}
data={Array []}
Expand All @@ -106,10 +94,8 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
</InternalFormItem>
<InternalFormItem>
<Field
component={[Function]}
id="issue_date"
Expand All @@ -122,10 +108,8 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
</InternalFormItem>
<InternalFormItem>
<Field
component={[Function]}
id="authorization_end_date"
Expand All @@ -137,10 +121,9 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
</InternalFormItem>
<Divider />
<FormItem
hasFeedback={false}
<InternalFormItem
label="Securities"
>
<Field
Expand All @@ -150,9 +133,8 @@ exports[`AddPermitForm renders properly 1`] = `
name="security_not_required"
onChange={[Function]}
/>
</FormItem>
<FormItem
hasFeedback={false}
</InternalFormItem>
<InternalFormItem
label="Assessed Liability Adjustment"
>
<p
Expand All @@ -175,17 +157,15 @@ exports[`AddPermitForm renders properly 1`] = `
]
}
/>
</FormItem>
<FormItem
hasFeedback={false}
>
</InternalFormItem>
<InternalFormItem>
<Field
component={[Function]}
id="security_received_date"
label="Security Received"
name="security_received_date"
/>
</FormItem>
</InternalFormItem>
</Col>
<Col
md={12}
Expand Down Expand Up @@ -255,8 +235,7 @@ exports[`AddPermitForm renders properly 1`] = `
}
/>
<Divider />
<FormItem
hasFeedback={false}
<InternalFormItem
label="Upload Files"
>
<Field
Expand All @@ -267,7 +246,7 @@ exports[`AddPermitForm renders properly 1`] = `
onFileLoad={[Function]}
onRemoveFile={[Function]}
/>
</FormItem>
</InternalFormItem>
</Col>
</Row>
<div
Expand Down Expand Up @@ -296,5 +275,5 @@ exports[`AddPermitForm renders properly 1`] = `
mockTitle
</Button>
</div>
</Form>
</ForwardRef(InternalForm)>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ exports[`AddTailingsForm renders properly 1`] = `
<FormItem
hasFeedback={false}
>
<Connect(PartySelectField)
<PartySelectField
allowAddingParties={true}
allowNull={true}
id="eor_party_guid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`PermitAmendmentForm renders properly 1`] = `
<FormItem
hasFeedback={false}
>
<Connect(PartySelectField)
<PartySelectField
allowAddingParties={true}
id="permittee_party_guid"
label="Permittee*"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import { PartySelectField } from "@/components/common/PartySelectField";
import { render } from "@testing-library/react";
import { ReduxWrapper } from "@mds/common/tests/utils/ReduxWrapper";
import { SEARCH, PARTIES } from "@mds/common/constants/reducerTypes";
import * as MOCK from "@mds/common/tests/mocks/dataMocks";
import FormWrapper from "@mds/common/components/forms/FormWrapper";

const initialState = {
[SEARCH]: { searchValues: { label: "Mock Party", value: "29489218432" } },
[PARTIES]: MOCK.PARTY.parties[0],
};

describe("PartySelectField", () => {
it("renders properly", () => {
const { container } = render(
<ReduxWrapper initialState={initialState}>
<FormWrapper name="test_party_select" isEditMode={false} onSubmit={jest.fn()}>
<PartySelectField validate={[]} allowAddingParties={true} name="test" />
</FormWrapper>
</ReduxWrapper>
);
expect(container).toMatchSnapshot();
});
});

This file was deleted.

Loading

0 comments on commit 2431487

Please sign in to comment.