Skip to content

Commit 23736b0

Browse files
committed
fix uts
1 parent f72f8eb commit 23736b0

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

test/unit/container_test.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import actor from '../../lib/actor.js'
1010
import container from '../../lib/container.js'
1111
import Translation from '../../lib/translation.js'
1212
import { resolveImportModulePath } from '../../lib/utils.js'
13-
import fs from 'fs'
13+
14+
const realDummyPagePath = path.resolve(__dirname, '../data/dummy_page.js');
15+
const realIPath = path.resolve(__dirname, '../data/I.js');
16+
const realHelperPath = path.resolve(__dirname, '../data/helper.js');
1417

1518
describe('Container', () => {
1619
before(() => {
@@ -155,20 +158,10 @@ describe('Container', () => {
155158

156159
describe('#create', () => {
157160
it('should create container with helpers', async () => {
158-
// --- ADD THIS DEBUGGING BLOCK ---
159-
const sandboxDir = path.resolve(__dirname, 'data/sandbox/data');
160-
console.log('--- CI DEBUGGING ---');
161-
console.log('Does directory exist?', fs.existsSync(sandboxDir));
162-
if (fs.existsSync(sandboxDir)) {
163-
console.log('Files inside directory:', fs.readdirSync(sandboxDir));
164-
}
165-
console.log('--------------------');
166-
// --------------------------------
167-
168161
const config = {
169162
helpers: {
170163
MyHelper: {
171-
require: './data/helper.js',
164+
require: realHelperPath,
172165
},
173166
FileSystem: {},
174167
},
@@ -192,7 +185,7 @@ describe('Container', () => {
192185
it('should load DI and return a reference to the module', async () => {
193186
await container.create({
194187
include: {
195-
dummyPage: './data/dummy_page.js',
188+
dummyPage: realDummyPagePath,
196189
},
197190
})
198191

@@ -204,7 +197,7 @@ describe('Container', () => {
204197
it('should load I from path and execute', async () => {
205198
await container.create({
206199
include: {
207-
I: './data/I.js',
200+
I: realIPath,
208201
},
209202
})
210203
expect(container.support('I')).is.ok
@@ -216,18 +209,20 @@ describe('Container', () => {
216209
it('should load DI includes provided as require paths', async () => {
217210
await container.create({
218211
include: {
219-
dummyPage: './data/dummy_page',
212+
dummyPage: realDummyPagePath,
220213
},
221214
})
222215
expect(container.support('dummyPage')).is.ok
223216
expect(container.support('dummyPage')).to.include.keys('openDummyPage')
224217
})
225218

226219
it('should load DI and inject I into PO', async () => {
220+
221+
227222
await container.create({
228223
include: {
229-
dummyPage: './data/dummy_page.js',
230-
I: './data/I.js',
224+
dummyPage: realDummyPagePath,
225+
I: realIPath,
231226
},
232227
})
233228
expect(container.support('dummyPage')).is.ok
@@ -239,8 +234,8 @@ describe('Container', () => {
239234
it('should load DI and inject custom I into PO', async () => {
240235
await container.create({
241236
include: {
242-
dummyPage: './data/dummy_page.js',
243-
I: './data/I.js',
237+
dummyPage: realDummyPagePath,
238+
I: realIPath,
244239
},
245240
})
246241
expect(container.support('dummyPage')).is.ok

0 commit comments

Comments
 (0)