Skip to content

Commit

Permalink
test: Removing negative config file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Feb 25, 2022
1 parent 8732592 commit 16f2dea
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 77 deletions.
28 changes: 1 addition & 27 deletions packages/cli/tests/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('config files', () => {
const logSpy = jest.spyOn(process.stdout, 'write');

await build(dir, {
prerenderUrls: `prerender/${moduleFormat}/${dataFormat}`,
prerenderUrls: `prerenderUrls/${moduleFormat}/${dataFormat}`,
});

expect(logSpy).not.toHaveBeenCalledWith(
Expand All @@ -46,22 +46,6 @@ describe('config files', () => {
);
});
});

it(`should fail to load malformed prerender-urls data in ${moduleFormat}`, async () => {
let dir = await subject('multiple-config-files');

const logSpy = jest.spyOn(process.stdout, 'write');

await build(dir, {
prerenderUrls: `prerender/${moduleFormat}/returns-bad-json.js`,
});

expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining(
'Failed to load prerenderUrls file, using default!'
)
);
});
});
});

Expand All @@ -76,16 +60,6 @@ describe('config files', () => {
).resolves.not.toThrow();
});
});

it(`should fail to load malformed config data in ${moduleFormat}`, async () => {
let dir = await subject('multiple-config-files');

await expect(
build(dir, {
config: `preactConfig/${moduleFormat}/returns-bad-config.js`,
})
).rejects.toThrow('Failed to load preact-cli config!');
});
});
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = function (config, env, helpers) {

};
module.exports = function () {};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
webpack(config, env, helpers) {}
webpack() {},
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export default function (config, env, helpers) {

};
export default function () {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
webpack (config, env, helpers) {}
webpack() {},
};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = [
{
url: '/',
},
{
url: '/custom',
},
];
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = () => [
{
"url": "/"
url: '/',
},
{
"url": "/custom"
}
url: '/custom',
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default [
{
url: '/',
},
{
url: '/custom',
},
];
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default () => [
{
"url": "/"
url: '/',
},
{
"url": "/custom"
}
url: '/custom',
},
];

0 comments on commit 16f2dea

Please sign in to comment.