Skip to content

Commit 743c15a

Browse files
committed
test: make specs OS-independent (use joinFromRoot)
1 parent 54bc9fa commit 743c15a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/steiger-plugin-fsd/src/no-wildcard-exports/index.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ it('reports no errors on a project with valid exports', () => {
2929
for (const child of folder.children) {
3030
if (child.type === 'file') {
3131
const fileWithContent = child as FileWithContent
32-
if (child.path.endsWith('shared/ui/index.ts')) {
32+
if (child.path === joinFromRoot('shared', 'ui', 'index.ts')) {
3333
fileWithContent.content = "export { Button } from './Button'"
34-
} else if (child.path.endsWith('entities/user/ui/index.ts')) {
34+
} else if (child.path === joinFromRoot('entities', 'user', 'ui', 'index.ts')) {
3535
fileWithContent.content = "export { UserCard } from './UserCard'"
36-
} else if (child.path.endsWith('entities/user/index.ts')) {
36+
} else if (child.path === joinFromRoot('entities', 'user', 'index.ts')) {
3737
fileWithContent.content = "export * as userModel from './model'"
38-
} else if (child.path.endsWith('features/auth/ui/index.ts')) {
38+
} else if (child.path === joinFromRoot('features', 'auth', 'ui', 'index.ts')) {
3939
fileWithContent.content = "export { LoginForm } from './LoginForm'"
4040
} else {
4141
fileWithContent.content = ''
@@ -69,9 +69,9 @@ it('reports errors on a project with wildcard exports', () => {
6969
for (const child of folder.children) {
7070
if (child.type === 'file') {
7171
const fileWithContent = child as FileWithContent
72-
if (child.path.endsWith('shared/ui/index.ts')) {
72+
if (child.path === joinFromRoot('shared', 'ui', 'index.ts')) {
7373
fileWithContent.content = "export * from './Button'"
74-
} else if (child.path.endsWith('entities/user/ui/index.ts')) {
74+
} else if (child.path === joinFromRoot('entities', 'user', 'ui', 'index.ts')) {
7575
fileWithContent.content = "export * from './UserCard'"
7676
} else {
7777
fileWithContent.content = ''
@@ -116,9 +116,9 @@ it('allows export * as namespace pattern', () => {
116116
for (const child of folder.children) {
117117
if (child.type === 'file') {
118118
const fileWithContent = child as FileWithContent
119-
if (child.path.endsWith('shared/ui/index.ts')) {
119+
if (child.path === joinFromRoot('shared', 'ui', 'index.ts')) {
120120
fileWithContent.content = "export * as positions from './positions'"
121-
} else if (child.path.endsWith('entities/user/index.ts')) {
121+
} else if (child.path === joinFromRoot('entities', 'user', 'index.ts')) {
122122
fileWithContent.content = "export * as userModel from './model'"
123123
} else {
124124
fileWithContent.content = ''
@@ -233,15 +233,15 @@ it('allows wildcard exports in unsliced layers (shared and app)', () => {
233233
for (const child of folder.children) {
234234
if (child.type === 'file') {
235235
const fileWithContent = child as FileWithContent
236-
if (child.path.endsWith('shared/ui/index.ts')) {
236+
if (child.path === joinFromRoot('shared', 'ui', 'index.ts')) {
237237
fileWithContent.content = "export * from './Button'\nexport * from './Modal'"
238-
} else if (child.path.endsWith('shared/api/index.ts')) {
238+
} else if (child.path === joinFromRoot('shared', 'api', 'index.ts')) {
239239
fileWithContent.content = "export * from './client'\nexport * from './endpoints'"
240-
} else if (child.path.endsWith('app/providers/index.ts')) {
240+
} else if (child.path === joinFromRoot('app', 'providers', 'index.ts')) {
241241
fileWithContent.content = "export * from './AuthProvider'\nexport * from './ThemeProvider'"
242-
} else if (child.path.endsWith('app/routes/index.ts')) {
242+
} else if (child.path === joinFromRoot('app', 'routes', 'index.ts')) {
243243
fileWithContent.content = "export * from './home'\nexport * from './auth'"
244-
} else if (child.path.endsWith('entities/user/ui/index.ts')) {
244+
} else if (child.path === joinFromRoot('entities', 'user', 'ui', 'index.ts')) {
245245
fileWithContent.content = "export { UserCard } from './UserCard'"
246246
} else {
247247
fileWithContent.content = ''

0 commit comments

Comments
 (0)