Skip to content

Commit 4b5b97c

Browse files
committed
test(themes): use path.join in migrate.test.ts stub args for Windows
The fs.readFileSync stub matched on a literal forward-slash path, but migrate.ts uses path.join which produces backslash-separated paths on Windows. The stub returned undefined there, breaking the request payload match.
1 parent f1d96f3 commit 4b5b97c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/zcli-themes/src/lib/migrate.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as sinon from 'sinon'
22
import * as fs from 'fs'
3+
import * as path from 'path'
34
import { expect } from '@oclif/test'
45
import * as getManifest from './getManifest'
56
import * as getTemplates from './getTemplates'
@@ -45,8 +46,8 @@ describe('migrate', () => {
4546
const readFileSyncStub = sinon.stub(fs, 'readFileSync')
4647
const requestStub = sinon.stub(request, 'requestAPI')
4748

48-
readFileSyncStub.withArgs('theme/path/style.css', 'utf8').returns('body { color: red; }')
49-
readFileSyncStub.withArgs('theme/path/script.js', 'utf8').returns('console.log("hi")')
49+
readFileSyncStub.withArgs(path.join('theme/path', 'style.css'), 'utf8').returns('body { color: red; }')
50+
readFileSyncStub.withArgs(path.join('theme/path', 'script.js'), 'utf8').returns('console.log("hi")')
5051

5152
getManifestStub.withArgs('theme/path').returns(manifest)
5253
getTemplatesStub.withArgs('theme/path').returns({

0 commit comments

Comments
 (0)