Skip to content

Commit 0e4bee3

Browse files
committed
remove unit test for deleted copyStaticAssets
1 parent 650e534 commit 0e4bee3

File tree

1 file changed

+1
-202
lines changed

1 file changed

+1
-202
lines changed

src/build/content/static.test.ts

Lines changed: 1 addition & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { createFsFixture } from '../../../tests/utils/fixture.js'
1313
import { HtmlBlob } from '../../shared/blob-types.cjs'
1414
import { PluginContext, RequiredServerFilesManifest } from '../plugin-context.js'
1515

16-
import { copyStaticAssets, copyStaticContent } from './static.js'
16+
import { copyStaticContent } from './static.js'
1717

1818
type Context = FixtureTestContext & {
1919
pluginContext: PluginContext
@@ -90,113 +90,6 @@ describe('Regular Repository layout', () => {
9090
} as NetlifyPluginOptions)
9191
})
9292

93-
test<Context>('should clear the static directory contents', async ({ pluginContext }) => {
94-
failBuildMock.mockImplementation(dontFailTest)
95-
const { vol } = mockFileSystem({
96-
[`${pluginContext.staticDir}/remove-me.js`]: '',
97-
})
98-
await copyStaticAssets(pluginContext)
99-
expect(Object.keys(vol.toJSON())).toEqual(
100-
expect.not.arrayContaining([`${pluginContext.staticDir}/remove-me.js`]),
101-
)
102-
// routes manifest fails to load because it doesn't exist and we expect that to fail the build
103-
expect(failBuildMock).toBeCalled()
104-
})
105-
106-
test<Context>('should link static content from the publish directory to the static directory (no basePath)', async ({
107-
pluginContext,
108-
...ctx
109-
}) => {
110-
const { cwd } = await createFsFixtureWithBasePath(
111-
{
112-
'.next/static/test.js': '',
113-
'.next/static/sub-dir/test2.js': '',
114-
},
115-
ctx,
116-
)
117-
118-
await copyStaticAssets(pluginContext)
119-
expect(await readDirRecursive(cwd)).toEqual(
120-
expect.arrayContaining([
121-
join(cwd, '.next/static/test.js'),
122-
join(cwd, '.next/static/sub-dir/test2.js'),
123-
join(pluginContext.staticDir, '/_next/static/test.js'),
124-
join(pluginContext.staticDir, '/_next/static/sub-dir/test2.js'),
125-
]),
126-
)
127-
})
128-
129-
test<Context>('should link static content from the publish directory to the static directory (with basePath)', async ({
130-
pluginContext,
131-
...ctx
132-
}) => {
133-
const { cwd } = await createFsFixtureWithBasePath(
134-
{
135-
'.next/static/test.js': '',
136-
'.next/static/sub-dir/test2.js': '',
137-
},
138-
ctx,
139-
{ basePath: '/base/path' },
140-
)
141-
142-
await copyStaticAssets(pluginContext)
143-
expect(await readDirRecursive(cwd)).toEqual(
144-
expect.arrayContaining([
145-
join(cwd, '.next/static/test.js'),
146-
join(cwd, '.next/static/sub-dir/test2.js'),
147-
join(pluginContext.staticDir, 'base/path/_next/static/test.js'),
148-
join(pluginContext.staticDir, 'base/path/_next/static/sub-dir/test2.js'),
149-
]),
150-
)
151-
})
152-
153-
test<Context>('should link static content from the public directory to the static directory (no basePath)', async ({
154-
pluginContext,
155-
...ctx
156-
}) => {
157-
const { cwd } = await createFsFixtureWithBasePath(
158-
{
159-
'public/fake-image.svg': '',
160-
'public/another-asset.json': '',
161-
},
162-
ctx,
163-
)
164-
165-
await copyStaticAssets(pluginContext)
166-
expect(await readDirRecursive(cwd)).toEqual(
167-
expect.arrayContaining([
168-
join(cwd, 'public/another-asset.json'),
169-
join(cwd, 'public/fake-image.svg'),
170-
join(pluginContext.staticDir, '/another-asset.json'),
171-
join(pluginContext.staticDir, '/fake-image.svg'),
172-
]),
173-
)
174-
})
175-
176-
test<Context>('should link static content from the public directory to the static directory (with basePath)', async ({
177-
pluginContext,
178-
...ctx
179-
}) => {
180-
const { cwd } = await createFsFixtureWithBasePath(
181-
{
182-
'public/fake-image.svg': '',
183-
'public/another-asset.json': '',
184-
},
185-
ctx,
186-
{ basePath: '/base/path' },
187-
)
188-
189-
await copyStaticAssets(pluginContext)
190-
expect(await readDirRecursive(cwd)).toEqual(
191-
expect.arrayContaining([
192-
join(cwd, 'public/another-asset.json'),
193-
join(cwd, 'public/fake-image.svg'),
194-
join(pluginContext.staticDir, '/base/path/another-asset.json'),
195-
join(pluginContext.staticDir, '/base/path/fake-image.svg'),
196-
]),
197-
)
198-
})
199-
20093
describe('should copy the static pages to the publish directory if there are no corresponding JSON files and mark wether html file is a fully static pages router page', () => {
20194
test<Context>('no i18n', async ({ pluginContext, ...ctx }) => {
20295
await createFsFixtureWithBasePath(
@@ -353,100 +246,6 @@ describe('Mono Repository', () => {
353246
} as NetlifyPluginOptions)
354247
})
355248

356-
test<Context>('should link static content from the publish directory to the static directory (no basePath)', async ({
357-
pluginContext,
358-
...ctx
359-
}) => {
360-
const { cwd } = await createFsFixtureWithBasePath(
361-
{
362-
'apps/app-1/.next/static/test.js': '',
363-
'apps/app-1/.next/static/sub-dir/test2.js': '',
364-
},
365-
ctx,
366-
)
367-
368-
await copyStaticAssets(pluginContext)
369-
expect(await readDirRecursive(cwd)).toEqual(
370-
expect.arrayContaining([
371-
join(cwd, 'apps/app-1/.next/static/test.js'),
372-
join(cwd, 'apps/app-1/.next/static/sub-dir/test2.js'),
373-
join(pluginContext.staticDir, '/_next/static/test.js'),
374-
join(pluginContext.staticDir, '/_next/static/sub-dir/test2.js'),
375-
]),
376-
)
377-
})
378-
379-
test<Context>('should link static content from the publish directory to the static directory (with basePath)', async ({
380-
pluginContext,
381-
...ctx
382-
}) => {
383-
const { cwd } = await createFsFixtureWithBasePath(
384-
{
385-
'apps/app-1/.next/static/test.js': '',
386-
'apps/app-1/.next/static/sub-dir/test2.js': '',
387-
},
388-
ctx,
389-
{ basePath: '/base/path' },
390-
)
391-
392-
await copyStaticAssets(pluginContext)
393-
expect(await readDirRecursive(cwd)).toEqual(
394-
expect.arrayContaining([
395-
join(cwd, 'apps/app-1/.next/static/test.js'),
396-
join(cwd, 'apps/app-1/.next/static/sub-dir/test2.js'),
397-
join(pluginContext.staticDir, '/base/path/_next/static/test.js'),
398-
join(pluginContext.staticDir, '/base/path/_next/static/sub-dir/test2.js'),
399-
]),
400-
)
401-
})
402-
403-
test<Context>('should link static content from the public directory to the static directory (no basePath)', async ({
404-
pluginContext,
405-
...ctx
406-
}) => {
407-
const { cwd } = await createFsFixtureWithBasePath(
408-
{
409-
'apps/app-1/public/fake-image.svg': '',
410-
'apps/app-1/public/another-asset.json': '',
411-
},
412-
ctx,
413-
)
414-
415-
await copyStaticAssets(pluginContext)
416-
expect(await readDirRecursive(cwd)).toEqual(
417-
expect.arrayContaining([
418-
join(cwd, 'apps/app-1/public/another-asset.json'),
419-
join(cwd, 'apps/app-1/public/fake-image.svg'),
420-
join(pluginContext.staticDir, '/another-asset.json'),
421-
join(pluginContext.staticDir, '/fake-image.svg'),
422-
]),
423-
)
424-
})
425-
426-
test<Context>('should link static content from the public directory to the static directory (with basePath)', async ({
427-
pluginContext,
428-
...ctx
429-
}) => {
430-
const { cwd } = await createFsFixtureWithBasePath(
431-
{
432-
'apps/app-1/public/fake-image.svg': '',
433-
'apps/app-1/public/another-asset.json': '',
434-
},
435-
ctx,
436-
{ basePath: '/base/path' },
437-
)
438-
439-
await copyStaticAssets(pluginContext)
440-
expect(await readDirRecursive(cwd)).toEqual(
441-
expect.arrayContaining([
442-
join(cwd, 'apps/app-1/public/another-asset.json'),
443-
join(cwd, 'apps/app-1/public/fake-image.svg'),
444-
join(pluginContext.staticDir, '/base/path/another-asset.json'),
445-
join(pluginContext.staticDir, '/base/path/fake-image.svg'),
446-
]),
447-
)
448-
})
449-
450249
describe('should copy the static pages to the publish directory if there are no corresponding JSON files and mark wether html file is a fully static pages router page', () => {
451250
test<Context>('no i18n', async ({ pluginContext, ...ctx }) => {
452251
await createFsFixtureWithBasePath(

0 commit comments

Comments
 (0)