Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add branching fixes and other fixes for advance request #2865

Merged
merged 15 commits into from
Apr 16, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ export const advanceRequestCustomFieldValuesData: AdvanceRequestCustomFieldValue
{
name: 'Phase',
value: 'Phase 1',
type: 'SELECT',
},
{
name: 'BILLABLE',
value: true,
type: 'BOOLEAN',
},
{
name: 'Arrival Date',
value: '2023-1-2',
type: 'DATE',
},
{
name: 'Checking',
value: 'option1',
type: 'OPTION',
},
];

Expand All @@ -28,4 +36,8 @@ export const advanceRequestCustomFieldValuesData2: AdvanceRequestCustomFieldValu
name: 'Arrival Date',
value: '2023-1-2',
},
{
name: 'Checking',
value: 'option1',
},
];
85 changes: 85 additions & 0 deletions src/app/core/mock-data/extended-advance-request.data.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cloneDeep } from 'lodash';
import { ApiV2Response } from '../models/api-v2.model';
import { ExtendedAdvanceRequestPublic } from '../models/extended-advance-request-public.model';
import { ExtendedAdvanceRequest } from '../models/extended_advance_request.model';
Expand Down Expand Up @@ -587,6 +588,78 @@ export const publicAdvanceRequestRes: ApiV2Response<ExtendedAdvanceRequestPublic
offset: 0,
};

export const publicAdvanceRequestResSentBack: ApiV2Response<ExtendedAdvanceRequestPublic> = {
count: 1,
data: [
{
areq_state: 'INQUIRY',
areq_is_pulled_back: false,
areq_is_sent_back: true,
areq_advance_request_number: 'A/2020/10/T/95',
areq_advance_id: 'advjrgwlk2Q',
areq_amount: 47.99,
areq_approved_at: new Date('2020-06-14T13:14:55.201Z'),
areq_created_at: new Date('2020-06-01T13:14:54.804Z'),
areq_currency: 'USD',
areq_id: 'areqiwr3Wwirk',
areq_notes: 'onsite client meeting',
areq_org_user_id: 'outGt9ju6qP',
areq_project_id: '1234',
areq_purpose: 'onsite client meeting',
areq_source: 'WEBAPP',
areq_updated_at: new Date('2020-06-11T13:14:55.201Z'),
ou_department: 'Tech',
ou_department_id: 'deptCjFrZcE0rH',
ou_id: 'outGt9ju6qP',
ou_org_id: 'orwruogwnngg',
ou_sub_department: 'Tech',
us_email: '[email protected]',
us_full_name: 'John Doe',
ou_employee_id: 'outGt9ju6qP',
areq_custom_field_values: [{ name: 'checking', value: 'true', type: 'BOOLEAN' }],
project_name: 'Fast and Furious',
project_code: 'C1234',
},
],
offset: 0,
};

export const publicAdvanceRequestResPulledBack: ApiV2Response<ExtendedAdvanceRequestPublic> = {
count: 1,
data: [
{
areq_state: 'DRAFT',
areq_is_pulled_back: true,
areq_is_sent_back: false,
areq_advance_request_number: 'A/2020/10/T/95',
areq_advance_id: 'advjrgwlk2Q',
areq_amount: 47.99,
areq_approved_at: new Date('2020-06-14T13:14:55.201Z'),
areq_created_at: new Date('2020-06-01T13:14:54.804Z'),
areq_currency: 'USD',
areq_id: 'areqiwr3Wwirl',
areq_notes: 'onsite client meeting',
areq_org_user_id: 'outGt9ju6qP',
areq_project_id: '1234',
areq_purpose: 'onsite client meeting',
areq_source: 'WEBAPP',
areq_updated_at: new Date('2020-06-11T13:14:55.201Z'),
ou_department: 'Tech',
ou_department_id: 'deptCjFrZcE0rH',
ou_id: 'outGt9ju6qP',
ou_org_id: 'orwruogwnngg',
ou_sub_department: 'Tech',
us_email: '[email protected]',
us_full_name: 'John Doe',
ou_employee_id: 'outGt9ju6qP',
areq_custom_field_values: [{ name: 'checking', value: 'true', type: 'BOOLEAN' }],
project_name: 'Fast and Furious',
project_code: 'C1234',
},
],
offset: 0,
};

export const publicAdvanceRequestRes2: ApiV2Response<ExtendedAdvanceRequestPublic> = {
...publicAdvanceRequestRes,
count: 250,
Expand Down Expand Up @@ -649,6 +722,18 @@ export const publicAdvanceRequestRes5: ApiV2Response<ExtendedAdvanceRequestPubli
offset: 0,
};

export const publicAdvanceRequestRes6: ExtendedAdvanceRequestPublic = {
...publicAdvanceRequestRes.data[0],
type: 'request',
currency: 'USD',
amount: 47.99,
created_at: new Date('2020-06-01T13:14:54.804Z'),
purpose: 'onsite client meeting',
state: 'DRAFT',
areq_is_sent_back: false,
areq_is_pulled_back: true,
};

export const allTeamAdvanceRequestsRes: ApiV2Response<ExtendedAdvanceRequest> = {
count: 43,
data: [
Expand Down
171 changes: 171 additions & 0 deletions src/app/core/mock-data/platform/v1/advance-request-platform.data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CustomFieldTypes } from 'src/app/core/enums/platform/v1/custom-fields-type.enum';
import { AdvanceRequestState } from 'src/app/core/models/advance-request-state.model';
import { AdvanceRequestPlatform } from 'src/app/core/models/platform/advance-request-platform.model';
import { PlatformApiResponse } from 'src/app/core/models/platform/platform-api-response.model';

Expand Down Expand Up @@ -86,3 +87,173 @@ export const advanceRequestPlatform: PlatformApiResponse<AdvanceRequestPlatform>
},
],
};

export const advanceRequestPlatformPulledBack: PlatformApiResponse<AdvanceRequestPlatform> = {
count: 1,
offset: 0,
data: [
{
advance: {
id: 'advkvnwrnpwi',
currency: 'USD',
amount: 47.99,
advance_request_id: 'advjrgwlk2Q',
seq_num: 'A/2020/10/T/95',
},
id: 'areqiwr3Wwirl',
user_id: 'uswjwgnwwgo',
user: {
id: 'uswjwgnwwgo',
email: '[email protected]',
full_name: 'John Doe',
},
approvals: [
{
approver_user_id: 'usge49ielgel',
approver_user: {
id: 'uswjwgnwwgo',
email: '[email protected]',
full_name: 'John Doe',
},
state: 'APPROVAL_PENDING',
},
],
org_id: 'orwruogwnngg',
created_at: new Date('2020-06-01T13:14:54.804+00:00'),
updated_at: new Date('2020-06-11T13:14:55.201598+00:00'),
currency: 'USD',
amount: 47.99,
policy_amount: 1500,
advance_id: 'advjrgwlk2Q',
seq_num: 'A/2020/10/T/95',
code: 'C1234',
notes: 'onsite client meeting',
purpose: 'onsite client meeting',
source: 'WEBAPP',
state: 'PULLED_BACK',
project_id: '1234',
project: {
id: 1234,
name: 'Fast and Furious',
sub_project: 'Formula One',
code: 'C1234',
display_name: 'Fast and Furious / Formula One',
},
is_policy_flagged: true,
is_exported: true,
employee_id: 'outGt9ju6qP',
employee: {
code: null,
department: {
code: null,
display_name: 'Tech',
id: 'deptCjFrZcE0rH',
name: 'Tech',
sub_department: 'Tech',
},
department_id: 'deptCjFrZcE0rH',
id: 'ouirDZ7tTLEQ',
org_id: 'orNVthTo2Zyo',
user: {
email: '[email protected]',
full_name: 'Arjun',
id: 'usJZ9bgfNB5n',
},
user_id: 'usJZ9bgfNB5n',
},
last_approved_at: new Date('2020-06-14T13:14:55.201598+00:00'),
custom_fields: [
{
name: 'checking',
value: 'true',
type: CustomFieldTypes.BOOLEAN,
},
],
},
],
};

export const advanceRequestPlatformSentBack: PlatformApiResponse<AdvanceRequestPlatform> = {
count: 1,
offset: 0,
data: [
{
advance: {
id: 'advkvnwrnpwi',
currency: 'USD',
amount: 47.99,
advance_request_id: 'advjrgwlk2Q',
seq_num: 'A/2020/10/T/95',
},
id: 'areqiwr3Wwirk',
user_id: 'uswjwgnwwgo',
user: {
id: 'uswjwgnwwgo',
email: '[email protected]',
full_name: 'John Doe',
},
approvals: [
{
approver_user_id: 'usge49ielgel',
approver_user: {
id: 'uswjwgnwwgo',
email: '[email protected]',
full_name: 'John Doe',
},
state: 'APPROVAL_PENDING',
},
],
org_id: 'orwruogwnngg',
created_at: new Date('2020-06-01T13:14:54.804+00:00'),
updated_at: new Date('2020-06-11T13:14:55.201598+00:00'),
currency: 'USD',
amount: 47.99,
policy_amount: 1500,
advance_id: 'advjrgwlk2Q',
seq_num: 'A/2020/10/T/95',
code: 'C1234',
notes: 'onsite client meeting',
purpose: 'onsite client meeting',
source: 'WEBAPP',
state: AdvanceRequestState.SENT_BACK,
project_id: '1234',
project: {
id: 1234,
name: 'Fast and Furious',
sub_project: 'Formula One',
code: 'C1234',
display_name: 'Fast and Furious / Formula One',
},
is_policy_flagged: true,
is_exported: true,
employee_id: 'outGt9ju6qP',
employee: {
code: null,
department: {
code: null,
display_name: 'Tech',
id: 'deptCjFrZcE0rH',
name: 'Tech',
sub_department: 'Tech',
},
department_id: 'deptCjFrZcE0rH',
id: 'ouirDZ7tTLEQ',
org_id: 'orNVthTo2Zyo',
user: {
email: '[email protected]',
full_name: 'Arjun',
id: 'usJZ9bgfNB5n',
},
user_id: 'usJZ9bgfNB5n',
},
last_approved_at: new Date('2020-06-14T13:14:55.201598+00:00'),
custom_fields: [
{
name: 'checking',
value: 'true',
type: CustomFieldTypes.BOOLEAN,
},
],
},
],
};
2 changes: 0 additions & 2 deletions src/app/core/mock-data/unflattened-advance-request.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ export const unflattenedAdvanceRequestData: UnflattenedAdvanceRequest = {
project_id: null,
custom_field_values: [
{
id: 159,
name: 'Advance Request Place',
value: 'd',
type: null,
},
{
id: 160,
name: 'Category',
value: 'Fyle is best',
type: null,
Expand Down
Loading
Loading