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

mes-9919-useTemplate #1771

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
activated useTemplate
  • Loading branch information
RLCorp committed Oct 8, 2024
commit 7fe3c0d808312152b64c05f31b8e3f95b00b3567
1 change: 0 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"rules": {
"recommended": true,
"style": {
"useTemplate": "off",
"useNodejsImportProtocol": "off",
"useDefaultParameterLast": "off",
"noParameterAssign": "off"
Expand Down
6 changes: 2 additions & 4 deletions mock/@capacitor-community/keep-awake.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export const KeepAwake = {
keepAwake: async () => {
},
allowSleep: async () => {
},
keepAwake: async () => {},
allowSleep: async () => {},
};
20 changes: 10 additions & 10 deletions mock/@capacitor/biometrics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const NativeBiometricMock = {
/* eslint-disable */
async isAvailable({ useFallback: boolean, }) {
return Promise.resolve({ biometryType: '', isAvailable: true });
},
async verifyIdentity({ reason: string, useFallback: boolean, }) {
return Promise.resolve(true);
},
setCredentials() {},
deleteCredentials() {},
/* eslint-enable */
/* eslint-disable */
async isAvailable({ useFallback: boolean }) {
return Promise.resolve({ biometryType: '', isAvailable: true });
},
async verifyIdentity({ reason: string, useFallback: boolean }) {
return Promise.resolve(true);
},
setCredentials() {},
deleteCredentials() {},
/* eslint-enable */
};
1 change: 0 additions & 1 deletion mock/@capacitor/status-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ interface StyleOptions {
interface AnimationOptions {
animation: Animation;
}

15 changes: 6 additions & 9 deletions mock/@capawesome/capacitor-screen-orientation.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { PluginListenerHandle } from '@capacitor/core';
import {
GetCurrentOrientationResult,
LockOptions,
ScreenOrientationChangeListener,
ScreenOrientationPlugin,
} from '@capawesome/capacitor-screen-orientation/dist/esm/definitions';
import { PluginListenerHandle } from '@capacitor/core';

export const ScreenOrientation: ScreenOrientationPlugin = {
async lock(options: LockOptions): Promise<void> {
},
async unlock(): Promise<void> {
},
async lock(options: LockOptions): Promise<void> {},
async unlock(): Promise<void> {},
async getCurrentOrientation(): Promise<GetCurrentOrientationResult> {
return {} as GetCurrentOrientationResult;
},
addListener(
eventName: 'screenOrientationChange',
listenerFunc: ScreenOrientationChangeListener,
listenerFunc: ScreenOrientationChangeListener
): Promise<PluginListenerHandle> & PluginListenerHandle {
return null;
},
async removeAllListeners(): Promise<void> {
},
async removeAllListeners(): Promise<void> {},
};

export enum OrientationType {
Expand All @@ -48,5 +45,5 @@ export enum OrientationType {
/**
* The orientation is in the secondary portrait mode.
*/
PORTRAIT_SECONDARY = 'portrait-secondary'
PORTRAIT_SECONDARY = 'portrait-secondary',
}
3 changes: 1 addition & 2 deletions mock/angular-mocks/application-ref.mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export class ApplicationRefMock {
tick = () => {
};
tick = () => {};
}
56 changes: 28 additions & 28 deletions mock/angular-mocks/dom-sanitizer.mock.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { Injectable, SecurityContext } from '@angular/core';
import {
DomSanitizer,
SafeHtml,
SafeResourceUrl,
SafeScript,
SafeStyle,
SafeUrl,
SafeValue
DomSanitizer,
SafeHtml,
SafeResourceUrl,
SafeScript,
SafeStyle,
SafeUrl,
SafeValue,
} from '@angular/platform-browser';
import { Injectable, SecurityContext } from '@angular/core';

@Injectable()
export class DomSanitizerMock extends DomSanitizer {
bypassSecurityTrustUrl(value: string): SafeUrl {
return 'some url';
}
bypassSecurityTrustUrl(value: string): SafeUrl {
return 'some url';
}

bypassSecurityTrustHtml(value: string): SafeHtml {
return 'some html';
}
bypassSecurityTrustHtml(value: string): SafeHtml {
return 'some html';
}

bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl {
return 'trust url';
}
bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl {
return 'trust url';
}

bypassSecurityTrustScript(value: string): SafeScript {
return 'trust script';
}
bypassSecurityTrustScript(value: string): SafeScript {
return 'trust script';
}

bypassSecurityTrustStyle(value: string): SafeStyle {
return 'trust style';
}
bypassSecurityTrustStyle(value: string): SafeStyle {
return 'trust style';
}

sanitize(context: SecurityContext, value: SafeValue | string | null): string | null;
sanitize(context: SecurityContext, value: SafeValue | string | null): string | null;

sanitize(context: SecurityContext, value: {} | string | null): string | null;
sanitize(context: SecurityContext, value: {} | string | null): string | null;

sanitize(context: SecurityContext, value: SafeValue | string | null | {}): string | null {
return 'sanitized';
}
sanitize(context: SecurityContext, value: SafeValue | string | null | {}): string | null {
return 'sanitized';
}
}
6 changes: 3 additions & 3 deletions mock/angular-mocks/nav-params.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NavParams } from '@ionic/angular';

@Injectable()
export class NavParamsMock extends NavParams {
get<T = any>(param: string): T {
return super.get(param);
}
get<T = any>(param: string): T {
RLCorp marked this conversation as resolved.
Show resolved Hide resolved
return super.get(param);
}
}
14 changes: 5 additions & 9 deletions mock/angular-mocks/router-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ export class RouterMock {

routerState = { root: '' };

navigate = jasmine.createSpy('navigate')
.and
.returnValue(Promise.resolve(true));
navigate = jasmine.createSpy('navigate').and.returnValue(Promise.resolve(true));
RLCorp marked this conversation as resolved.
Show resolved Hide resolved

navigateByUrl = jasmine.createSpy('navigateByUrl')
.and
.returnValue(Promise.resolve(true));
navigateByUrl = jasmine.createSpy('navigateByUrl').and.returnValue(Promise.resolve(true));

getCurrentNavigation = jasmine.createSpy('getCurrentNavigation')
.and
.returnValue({ extras: { state: { hasNavigatedFromUnsubmitted: true } } });
getCurrentNavigation = jasmine
.createSpy('getCurrentNavigation')
.and.returnValue({ extras: { state: { hasNavigatedFromUnsubmitted: true } } });
}
13 changes: 6 additions & 7 deletions mock/generate-local-journal-non-test-activities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const journalSchema = require('@dvsa/mes-journal-schema/index.json');
import { writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { getTodayAsIsoDate, getIsoDateDaysInFuture } from './mock-date-utils';
import { getIsoDateDaysInFuture, getTodayAsIsoDate } from './mock-date-utils';

const today = getTodayAsIsoDate();

Expand Down Expand Up @@ -74,11 +74,7 @@ export const localNonTestActivities = {
testCategory: 'B+E',
vehicleGearbox: 'Manual',
},
previousCancellation: [
'Act of nature',
'DSA',
'DSA',
],
previousCancellation: ['Act of nature', 'DSA', 'DSA'],
business: {
businessId: 1000,
businessName: 'Daves Dodgy Driving Instructors',
Expand Down Expand Up @@ -221,5 +217,8 @@ export const localNonTestActivities = {
};

// tslint:disable-next-line:max-line-length
writeFileSync(join(`${dirname(process.argv[1])}`, 'local-journal-non-test-activities.json'), JSON.stringify(localNonTestActivities, null, 2));
writeFileSync(
join(`${dirname(process.argv[1])}`, 'local-journal-non-test-activities.json'),
JSON.stringify(localNonTestActivities, null, 2)
);
console.log('Local NTA journal updated');
11 changes: 3 additions & 8 deletions mock/generate-local-journal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ExaminerWorkSchedule } from '@dvsa/mes-journal-schema';
import { writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { ExaminerWorkSchedule } from '@dvsa/mes-journal-schema';
import { getNextWorkingDayAsIsoDate, getPreviousWorkingDayAsIsoDate, getTodayAsIsoDate } from './mock-date-utils';

const journalSchema = require('@dvsa/mes-journal-schema/index.json');
Expand Down Expand Up @@ -70,9 +70,7 @@ export const localJournal: ExaminerWorkSchedule = {
businessName: 'Business Name',
telephone: '0234 234433',
},
previousCancellation: [
'Act of nature',
],
previousCancellation: ['Act of nature'],
},
slotDetail: {
duration: 57,
Expand Down Expand Up @@ -124,10 +122,7 @@ export const localJournal: ExaminerWorkSchedule = {
dateOfBirth: '1979-10-20',
ethnicityCode: 'A',
},
previousCancellation: [
'DSA',
'Act of nature',
],
previousCancellation: ['DSA', 'Act of nature'],
},
slotDetail: {
duration: 57,
Expand Down
81 changes: 40 additions & 41 deletions mock/generate-local-test-centre-journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,62 @@ import { inNext2Days } from './mock-date-utils';

const filterByTestCentreAndDate = <T>(info: T[] = []): T[] => {
return info.filter((section: TestSlot | NonTestActivity | Deployment | AdvanceTestSlot) => {
return (
section.testCentre &&
inNext2Days(section)
);
return section.testCentre && inNext2Days(section);
});
};


const localTestCentreJournal = {
"staffNumber": "1234567",
"examiners": [
staffNumber: '1234567',
examiners: [
{
"name": "Joe Bloggs",
"staffNumber": "1234567",
"journal": {
name: 'Joe Bloggs',
staffNumber: '1234567',
journal: {
...localJournal.examiner,
testSlots: filterByTestCentreAndDate( localJournal.testSlots),
advanceTestSlots: filterByTestCentreAndDate( localJournal.advanceTestSlots),
nonTestActivities: filterByTestCentreAndDate( localJournal.nonTestActivities),
deployments: filterByTestCentreAndDate( localJournal.deployments),
}
testSlots: filterByTestCentreAndDate(localJournal.testSlots),
advanceTestSlots: filterByTestCentreAndDate(localJournal.advanceTestSlots),
nonTestActivities: filterByTestCentreAndDate(localJournal.nonTestActivities),
deployments: filterByTestCentreAndDate(localJournal.deployments),
},
},
{
"name": "Homer Simpson",
"staffNumber": "4362819",
"journal": {
name: 'Homer Simpson',
staffNumber: '4362819',
journal: {
...localNonTestActivities,
testSlots: filterByTestCentreAndDate( localNonTestActivities.testSlots),
advanceTestSlots: filterByTestCentreAndDate( localNonTestActivities.advanceTestSlots),
nonTestActivities: filterByTestCentreAndDate( localNonTestActivities.nonTestActivities),
deployments: filterByTestCentreAndDate( localNonTestActivities.deployments),
}
testSlots: filterByTestCentreAndDate(localNonTestActivities.testSlots),
advanceTestSlots: filterByTestCentreAndDate(localNonTestActivities.advanceTestSlots),
nonTestActivities: filterByTestCentreAndDate(localNonTestActivities.nonTestActivities),
deployments: filterByTestCentreAndDate(localNonTestActivities.deployments),
},
},
{
"name": "Bart Simpson",
"staffNumber": "2345433",
"journal": null,
"error": "Journal not found"
name: 'Bart Simpson',
staffNumber: '2345433',
journal: null,
error: 'Journal not found',
},
{
"name": "John Doe",
"staffNumber": "8754209",
"journal": null,
"error": "Journal decompression error"
}
name: 'John Doe',
staffNumber: '8754209',
journal: null,
error: 'Journal decompression error',
},
],
"testCentres": [
testCentres: [
{
"name": "TEST CENTRE A",
"id": 54321
name: 'TEST CENTRE A',
id: 54321,
},
{
"name": "TEST CENTRE B",
"id": 45670
}
]
}
name: 'TEST CENTRE B',
id: 45670,
},
],
};

writeFileSync(join(`${dirname(process.argv[1])}`, 'local-test-centre-journal.json'), JSON.stringify(localTestCentreJournal, null, 2));
writeFileSync(
join(`${dirname(process.argv[1])}`, 'local-test-centre-journal.json'),
JSON.stringify(localTestCentreJournal, null, 2)
);
console.log('Local test centre journal updated');
4 changes: 1 addition & 3 deletions mock/ionic-mocks/alert-controller.mock.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { AlertOptions } from '@ionic/core';
import { Injectable } from '@angular/core';
import { AlertOptions } from '@ionic/core';

@Injectable()
export class AlertControllerMock {

create(options: AlertOptions): Promise<HTMLIonAlertElement> {
return Promise.resolve({
present: () => Promise.resolve(),
Expand All @@ -15,5 +14,4 @@ export class AlertControllerMock {
getTop(): Promise<HTMLIonAlertElement | undefined> {
return Promise.resolve({} as HTMLIonAlertElement);
}

}
7 changes: 3 additions & 4 deletions mock/ionic-mocks/is-debug.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { IsDebug } from '@awesome-cordova-plugins/is-debug/ngx';

@Injectable()
export class IsDebugMock implements IsDebug {

getIsDebug(): Promise<boolean> {
return Promise.resolve(false);
}
getIsDebug(): Promise<boolean> {
return Promise.resolve(false);
}
}
Loading