Skip to content

Commit

Permalink
chore: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Apr 5, 2024
1 parent e016590 commit cc2a0a1
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
12 changes: 6 additions & 6 deletions apps/package-manager/packages/generic/src/packageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class ExpectationManagerCallbacksHandler implements ExpectationManagerCallbacks

public reportExpectationStatus(
expectationId: ExpectationId,
expectaction: Expectation.Any | null,
expectation: Expectation.Any | null,
actualVersionHash: string | null,
statusInfo: {
status?: ExpectedPackageStatusAPI.WorkStatusState
Expand All @@ -521,17 +521,17 @@ class ExpectationManagerCallbacksHandler implements ExpectationManagerCallbacks
prevStatusReasons?: { [state: string]: Reason }
}
): void {
if (!expectaction) {
if (!expectation) {
if (this.toReportExpectationStatuses.has(expectationId)) {
this.updateExpectationStatus(expectationId, null)
}
} else {
if (!expectaction.statusReport.sendReport) return // Don't report the status
if (!expectation.statusReport.sendReport) return // Don't report the status

const previouslyReported = this.toReportExpectationStatuses.get(expectationId)?.status

// Remove undefined properties, so they don't mess with the spread operators below:
deleteAllUndefinedProperties(expectaction.statusReport)
deleteAllUndefinedProperties(expectation.statusReport)
deleteAllUndefinedProperties(statusInfo)

const workStatus: ExpectedPackageStatusAPI.WorkStatus = {
Expand All @@ -548,10 +548,10 @@ class ExpectationManagerCallbacksHandler implements ExpectationManagerCallbacks
...((previouslyReported || {}) as Partial<ExpectedPackageStatusAPI.WorkStatus>), // Intentionally cast to Partial<>, to make typings in const workStatus more strict

// Updated properties:
...expectaction.statusReport,
...expectation.statusReport,
...statusInfo,

fromPackages: expectaction.fromPackages.map((fromPackage) => {
fromPackages: expectation.fromPackages.map((fromPackage) => {
const fromPackageId = unprotectString(fromPackage.id)
const prevPromPackage = this.toReportExpectationStatuses
.get(expectationId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export type MessageFromWorker = (message: ExpectationManagerWorkerAgent.MessageF
export interface ExpectationManagerCallbacks {
reportExpectationStatus: (
expectationId: ExpectationId,
expectaction: Expectation.Any | null,
expectation: Expectation.Any | null,
actualVersionHash: string | null,
statusInfo: {
status?: ExpectedPackageStatusAPI.WorkStatusState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { TrackedPackageContainerAPI } from './lib/trackedPackageContainerAPI'
import { TrackedPackageContainerPackageAPI } from './lib/trackedPackageContainerPackageAPI'

/**
* The ExpectationTracker is responsible for tracking and uptating the state of the Expectations
* The ExpectationTracker is responsible for tracking and updating the state of the Expectations
*/
export class ExpectationTracker extends HelpfulEventEmitter {
public constants: ExpectationTrackerConstants
Expand Down Expand Up @@ -93,9 +93,9 @@ export class ExpectationTracker extends HelpfulEventEmitter {
public getFulfilledWaitTime(): number {
return (
// Default minimum time to wait:
this.constants.FULLFILLED_MONITOR_TIME +
this.constants.FULFILLED_MONITOR_TIME +
// Also add some more time, so that we don't check too often when we have a lot of expectations:
this.constants.FULLFILLED_MONITOR_TIME_ADD_PER_EXPECTATION * this.trackedExpectations.getIds().length
this.constants.FULFILLED_MONITOR_TIME_ADD_PER_EXPECTATION * this.trackedExpectations.getIds().length
)
}
/** Called when there is a monitor-status-update from a worker */
Expand Down
10 changes: 5 additions & 5 deletions shared/packages/expectationManager/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ export interface ExpectationTrackerConstants {
/** Time between iterations of the expectation queue [ms] */
EVALUATE_INTERVAL: number
/** Minimum time between re-evaluating fulfilled expectations [ms] */
FULLFILLED_MONITOR_TIME: number
/** Added to FULLFILLED_MONITOR_TIME, a time-per-expectation [ms] */
FULLFILLED_MONITOR_TIME_ADD_PER_EXPECTATION: number
FULFILLED_MONITOR_TIME: number
/** Added to FULFILLED_MONITOR_TIME, a time-per-expectation [ms] */
FULFILLED_MONITOR_TIME_ADD_PER_EXPECTATION: number
/**
* If the iteration of the queue has been going for this time
* allow skipping the rest of the queue in order to reiterate the high-prio expectations [ms]
Expand Down Expand Up @@ -39,8 +39,8 @@ export function getDefaultConstants(): ExpectationTrackerConstants {
return {
// Default values:
EVALUATE_INTERVAL: 5 * 1000,
FULLFILLED_MONITOR_TIME: 30 * 1000,
FULLFILLED_MONITOR_TIME_ADD_PER_EXPECTATION: 0.02,
FULFILLED_MONITOR_TIME: 30 * 1000,
FULFILLED_MONITOR_TIME_ADD_PER_EXPECTATION: 0.02,
WORK_TIMEOUT_TIME: 30 * 1000,
ALLOW_SKIPPING_QUEUE_TIME: 30 * 1000,
SCALE_UP_TIME: 5 * 1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const JsonDataCopy: ExpectationHandlerGenericWorker = {
},
isExpectationFulfilled: async (
exp: Expectation.Any,
wasFullfilled: boolean,
wasFulfilled: boolean,
worker: BaseWorker
): Promise<ReturnTypeIsExpectationFulfilled> => {
if (!isJsonDataCopy(exp)) throw new Error(`Wrong exp.type: "${exp.type}"`)
Expand Down Expand Up @@ -104,7 +104,7 @@ export const JsonDataCopy: ExpectationHandlerGenericWorker = {
exp.endRequirement.version
)
if (packageInfoSynced.needsUpdate) {
if (wasFullfilled) {
if (wasFulfilled) {
// Remove the outdated result:
await lookupTarget.handle.removePackageInfo(PackageInfoType.JSON, exp)
}
Expand Down
6 changes: 3 additions & 3 deletions tests/internal-tests/src/__tests__/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import type * as fsMockType from '../__mocks__/fs'
import type * as WNDType from '../__mocks__/windows-network-drive'
import type * as QGatewayClientType from '../__mocks__/tv-automation-quantel-gateway-client'
import { prepareTestEnviromnent, TestEnviromnent } from './lib/setupEnv'
import { prepareTestEnvironment, TestEnvironment } from './lib/setupEnv'
import { describeForAllPlatforms, waitUntil } from './lib/lib'
import {
getCorePackageInfoTarget,
Expand Down Expand Up @@ -49,12 +49,12 @@ const SOURCE1 = protectString<PackageContainerId>('source1')
const TARGET0 = protectString<PackageContainerId>('target0')
const TARGET1 = protectString<PackageContainerId>('target1')

let env: TestEnviromnent
let env: TestEnvironment
describeForAllPlatforms(
'Basic',
() => {
beforeAll(async () => {
env = await prepareTestEnviromnent(false) // set to true to enable debug-logging
env = await prepareTestEnvironment(false) // set to true to enable debug-logging
// Verify that the fs mock works:
expect(fs.lstat).toBeTruthy()
expect(fs.__mockReset).toBeTruthy()
Expand Down
8 changes: 4 additions & 4 deletions tests/internal-tests/src/__tests__/issues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
INNER_ACTION_TIMEOUT,
} from '@sofie-package-manager/api'
import type * as fsMockType from '../__mocks__/fs'
import { prepareTestEnviromnent, TestEnviromnent } from './lib/setupEnv'
import { prepareTestEnvironment, TestEnvironment } from './lib/setupEnv'
import { waitUntil, waitTime, describeForAllPlatforms } from './lib/lib'
import { getLocalSource, getLocalTarget } from './lib/containers'
import { WorkerAgent } from '@sofie-package-manager/worker'
Expand Down Expand Up @@ -54,12 +54,12 @@ const SOURCE0 = protectString<PackageContainerId>('source0')
const TARGET0 = protectString<PackageContainerId>('target0')
const TARGET1 = protectString<PackageContainerId>('target1')

let env: TestEnviromnent
let env: TestEnvironment
describeForAllPlatforms(
'Handle unhappy paths',
() => {
beforeAll(async () => {
env = await prepareTestEnviromnent(false) // set to true to enable debug-logging
env = await prepareTestEnvironment(false) // set to true to enable debug-logging
// Verify that the fs mock works:
expect(fs.lstat).toBeTruthy()
expect(fs.__mockReset).toBeTruthy()
Expand Down Expand Up @@ -536,7 +536,7 @@ describeForAllPlatforms(
}
)
function addCopyFileExpectation(
env: TestEnviromnent,
env: TestEnvironment,
expectationId: ExpectationId,
sources: Expectation.SpecificPackageContainerOnPackage.FileSource[],
targets: [Expectation.SpecificPackageContainerOnPackage.FileTarget]
Expand Down
8 changes: 4 additions & 4 deletions tests/internal-tests/src/__tests__/lib/setupEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export async function setupExpectationManager(
}
}

export async function prepareTestEnviromnent(debugLogging: boolean): Promise<TestEnviromnent> {
export async function prepareTestEnvironment(debugLogging: boolean): Promise<TestEnvironment> {
const managerStatuses: Statuses = {}
const expectationStatuses: ExpectationStatuses = {}
const containerStatuses: ContainerStatuses = {}
Expand Down Expand Up @@ -233,7 +233,7 @@ export async function prepareTestEnviromnent(debugLogging: boolean): Promise<Tes
},
reportExpectationStatus: (
expectationId: ExpectationId,
_expectaction: Expectation.Any | null,
_expectation: Expectation.Any | null,
actualVersionHash: string | null,
statusInfo: {
status?: string
Expand Down Expand Up @@ -300,7 +300,7 @@ export async function prepareTestEnviromnent(debugLogging: boolean): Promise<Tes
literal<ExpectationManagerOptions>({
constants: {
EVALUATE_INTERVAL: WAIT_SCAN_TIME - WAIT_JOB_TIME - 300,
FULLFILLED_MONITOR_TIME: WAIT_SCAN_TIME - WAIT_JOB_TIME - 300,
FULFILLED_MONITOR_TIME: WAIT_SCAN_TIME - WAIT_JOB_TIME - 300,
WORK_TIMEOUT_TIME: WORK_TIMEOUT_TIME - 300,
ERROR_WAIT_TIME: ERROR_WAIT_TIME - 300,

Expand Down Expand Up @@ -348,7 +348,7 @@ export async function prepareTestEnviromnent(debugLogging: boolean): Promise<Tes
setLogFilterFunction: setLogFilterFunction,
}
}
export interface TestEnviromnent {
export interface TestEnvironment {
WAIT_JOB_TIME: number
/** A little longer than WAIT_JOB_TIME, to be used in waitUntil()-expressions */
WAIT_JOB_TIME_SAFE: number
Expand Down
6 changes: 3 additions & 3 deletions tests/internal-tests/src/__tests__/quantel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
waitTime,
} from '@sofie-package-manager/api'
import type * as QGatewayClientType from '../__mocks__/tv-automation-quantel-gateway-client'
import { prepareTestEnviromnent, TestEnviromnent } from './lib/setupEnv'
import { prepareTestEnvironment, TestEnvironment } from './lib/setupEnv'
import { describeForAllPlatforms, waitUntil } from './lib/lib'
import { getQuantelSource, getQuantelTarget } from './lib/containers'
jest.mock('child_process')
Expand All @@ -21,12 +21,12 @@ jest.mock('@parcel/watcher')

const QGatewayClient = QGatewayClientOrg as any as typeof QGatewayClientType

let env: TestEnviromnent
let env: TestEnvironment
describeForAllPlatforms(
'Quantel',
() => {
beforeAll(async () => {
env = await prepareTestEnviromnent(false) // set to true to enable debug-logging
env = await prepareTestEnvironment(false) // set to true to enable debug-logging
})
afterAll(() => {
env.terminate()
Expand Down

0 comments on commit cc2a0a1

Please sign in to comment.