Skip to content

Commit c596188

Browse files
committed
test(job): scope JobClassRoundTripSpec locals with local.
Second wheels-bot review follow-up from the same batch, on PR #3358. Every sibling in vendor/wheels/tests/specs/jobs/ declares spec variables with `local.` (e.g. `local.bootstrapJob = new wheels.Job();` in JobRobustnessSpec). JobClassRoundTripSpec assigned them unscoped, which runs green but leaks the writes into the spec's `variables` scope. Purely a convention fix — no behaviour change. Folded in here rather than opened as a third PR, since it is the same review round on the same merged batch. lucee7 + sqlite, full core suite: 4756 pass / 0 fail / 0 error, unchanged. Signed-off-by: Peter Amiri <peter@alurium.com>
1 parent 950a5df commit c596188

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

vendor/wheels/tests/specs/jobs/JobClassRoundTripSpec.cfc

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ component extends="wheels.WheelsTest" {
1717
describe("Tests that the persisted jobClass round-trips", () => {
1818

1919
it("reports a metadata name whose last segment matches the .cfc file name exactly", () => {
20-
job = CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")
21-
meta = GetMetadata(job)
20+
local.job = CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")
21+
local.meta = GetMetadata(local.job)
2222

23-
fileName = ListFirst(ListLast(Replace(meta.path, "\", "/", "all"), "/"), ".")
23+
local.fileName = ListFirst(ListLast(Replace(local.meta.path, "\", "/", "all"), "/"), ".")
2424

2525
// case-sensitive comparison — Compare(), not CompareNoCase()
26-
expect(Compare(ListLast(meta.name, "."), fileName)).toBe(0)
26+
expect(Compare(ListLast(local.meta.name, "."), local.fileName)).toBe(0)
2727
})
2828

2929
it("never persists a caller's miscased path", () => {
@@ -43,74 +43,74 @@ component extends="wheels.WheelsTest" {
4343
//
4444
// Asserting only the first would fail on Adobe for a reason that is *safer*
4545
// than the one being tested, so assert the property both satisfy.
46-
canonical = GetMetadata(CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")).name
47-
resolved = {miscasedConstructed = false, name = ""}
46+
local.canonical = GetMetadata(CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")).name
47+
local.resolved = {miscasedConstructed = false, name = ""}
4848

4949
try {
50-
resolved.name = GetMetadata(CreateObject("component", "wheels.tests._assets.jobs.probejob")).name
51-
resolved.miscasedConstructed = true
50+
local.resolved.name = GetMetadata(CreateObject("component", "wheels.tests._assets.jobs.probejob")).name
51+
local.resolved.miscasedConstructed = true
5252
} catch (any e) {
5353
// case-sensitive resolver — the stronger guarantee
5454
}
5555

56-
if (resolved.miscasedConstructed) {
57-
expect(Compare(resolved.name, canonical)).toBe(0)
56+
if (local.resolved.miscasedConstructed) {
57+
expect(Compare(local.resolved.name, local.canonical)).toBe(0)
5858
} else {
59-
expect(resolved.name).toBe("")
59+
expect(local.resolved.name).toBe("")
6060
}
6161
})
6262

6363
it("re-instantiates from its own persisted metadata name", () => {
6464
// the actual enqueue -> drain round trip, without touching the queue table
65-
original = CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")
66-
persisted = GetMetadata(original).name
65+
local.original = CreateObject("component", "wheels.tests._assets.jobs.ProbeJob")
66+
local.persisted = GetMetadata(local.original).name
6767

6868
// Hoisted receiver. A parenthesized `new` in receiver position — `(new X()).m()`
6969
// — is rejected by Adobe's parser with `Invalid construct: Either argument or
7070
// name is missing`, the same MissingNameException family as cross-engine
7171
// invariant 16. Adobe blames the enclosing describe() line and the whole engine
7272
// leg reports tests=0. Caught by the compat matrix; Lucee and BoxLang accept it.
73-
bridge = new wheels.Job()
74-
revived = bridge.$instantiateJobClass(jobClass = persisted)
73+
local.bridge = new wheels.Job()
74+
local.revived = local.bridge.$instantiateJobClass(jobClass = local.persisted)
7575

76-
expect(Compare(GetMetadata(revived).name, persisted)).toBe(0)
76+
expect(Compare(GetMetadata(local.revived).name, local.persisted)).toBe(0)
7777
})
7878
})
7979

8080
describe("Tests that an unresolvable jobClass", () => {
8181

8282
it("throws Wheels.JobClassNotFound naming the row and the class", () => {
83-
thrown = {type: "", message: ""}
83+
local.thrown = {type: "", message: ""}
8484

85-
bridge = new wheels.Job()
85+
local.bridge = new wheels.Job()
8686

8787
try {
88-
bridge.$instantiateJobClass(jobClass = "app.jobs.NoSuchJob", jobId = "abc-123")
88+
local.bridge.$instantiateJobClass(jobClass = "app.jobs.NoSuchJob", jobId = "abc-123")
8989
} catch (any e) {
90-
thrown.type = e.type
91-
thrown.message = e.message
90+
local.thrown.type = e.type
91+
local.thrown.message = e.message
9292
}
9393

9494
// the raw engine error is "component not found" for a class that plainly
9595
// exists, which points investigators at mappings and deployment
96-
expect(thrown.type).toBe("Wheels.JobClassNotFound")
97-
expect(thrown.message).toInclude("app.jobs.NoSuchJob")
98-
expect(thrown.message).toInclude("abc-123")
96+
expect(local.thrown.type).toBe("Wheels.JobClassNotFound")
97+
expect(local.thrown.message).toInclude("app.jobs.NoSuchJob")
98+
expect(local.thrown.message).toInclude("abc-123")
9999
})
100100

101101
it("throws Wheels.InvalidJobClass when the path resolves to something that is not a job", () => {
102-
thrown = {type: ""}
102+
local.thrown = {type: ""}
103103

104-
bridge = new wheels.Job()
104+
local.bridge = new wheels.Job()
105105

106106
try {
107107
// a real component with no perform()
108-
bridge.$instantiateJobClass(jobClass = "wheels.tests._assets.models.Post")
108+
local.bridge.$instantiateJobClass(jobClass = "wheels.tests._assets.models.Post")
109109
} catch (any e) {
110-
thrown.type = e.type
110+
local.thrown.type = e.type
111111
}
112112

113-
expect(thrown.type).toBe("Wheels.InvalidJobClass")
113+
expect(local.thrown.type).toBe("Wheels.InvalidJobClass")
114114
})
115115
})
116116
}

0 commit comments

Comments
 (0)