Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 466cb40

Browse files
fix tests
1 parent 9ed16be commit 466cb40

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@
5858
"<rootDir>/packages/serverless-nextjs-plugin/utils/yml/cfSchema.js",
5959
"<rootDir>/packages/serverless-nextjs-plugin/utils/test",
6060
"/.serverless_nextjs/",
61-
"/fixtures/"
61+
"/fixtures/",
62+
"/examples/"
6263
],
6364
"testPathIgnorePatterns": [
6465
"/.next/",
6566
"/node_modules/",
6667
"/fixtures/"
6768
],
6869
"modulePathIgnorePatterns": [
69-
"<rootDir>/examples/",
70+
"/examples/",
7071
"<rootDir>/integration"
7172
],
7273
"modulePaths": [

packages/serverless-nextjs-component/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,7 @@ Of course there are tradeoffs ... An architecture using one lambda per page in t
101101
_How do I interact with other AWS Services within my app_?
102102
103103
See `examples/dynamodb-crud` for an example Todo application that interacts with DynamoDB.
104+
105+
_Should I use the [serverless-nextjs-plugin](https://github.com/danielcondemarin/serverless-nextjs-plugin/tree/master/packages/serverless-nextjs-plugin) or this component?_
106+
107+
Users are enocouraged to use this component instead of the `serverless-nextjs-plugin`. This component was built and designed to fix issues the plugin has like the [CloudFormation resource limit](https://github.com/danielcondemarin/serverless-nextjs-plugin/issues/17).

packages/serverless-nextjs-plugin/__mocks__/aws-sdk.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,13 @@ MockCloudFormation.prototype.validateTemplate = mockValidateTemplate;
5757
MockCloudFormation.prototype.updateStack = mockUpdateStack;
5858
MockCloudFormation.prototype.listStackResources = mockListStackResources;
5959

60-
// function MockS3() {}
61-
6260
const {
6361
mockFunction: mockListObjectsV2,
6462
mockPromise: mockListObjectsV2Promise
6563
} = promisify(jest.fn());
6664

6765
const S3MockUpload = promisify(jest.fn());
6866

69-
// MockS3.prototype.listObjectsV2 = mockListObjectsV2;
70-
// MockS3.prototype.upload = mockUpload;
71-
7267
const MockSTS = function() {};
7368
const {
7469
mockFunction: mockGetCallerIdentity,
@@ -94,7 +89,6 @@ MockMetadataService.prototype.request = mockMetadataRequest;
9489
module.exports = {
9590
EnvironmentCredentials: MockEnvironmentCredentials,
9691
S3: jest.fn(() => {
97-
console.log("CALLED!!!!!!!!");
9892
return {
9993
upload: S3MockUpload.mockFunction,
10094
listObjectsV2: mockListObjectsV2

packages/serverless-nextjs-plugin/__tests__/one-page-app.test.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@ describe("one page app", () => {
4242
expect(assetsBucket.Properties.BucketName).toEqual("onepageappbucket");
4343
});
4444
});
45-
46-
it.only("uploads build assets", () => {
47-
expect(AWS.mockUpload).toBeCalledWith({
48-
ACL: "public-read",
49-
Bucket: "onepageappbucket",
50-
Key: "_next/static/client.js",
51-
ContentType: "text/javascript",
52-
Body: expect.any(fs.ReadStream)
53-
});
54-
});
5545
});
5646

5747
describe("Page lambda function", () => {

packages/serverless-nextjs-plugin/__tests__/single-api.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const nextBuild = require("next/dist/build");
22
const path = require("path");
33
const AdmZip = require("adm-zip");
4-
const readCloudFormationUpdateTemplate = require("../utils/test/readCloudFormationUpdateTemplate");
4+
const {
5+
readUpdateTemplate
6+
} = require("../utils/test/readServerlessCFTemplate");
57
const testableServerless = require("../utils/test/testableServerless");
68

79
jest.mock("next/dist/build");
@@ -16,9 +18,7 @@ describe("single api", () => {
1618

1719
await testableServerless(fixturePath, "package");
1820

19-
const cloudFormationUpdateTemplate = await readCloudFormationUpdateTemplate(
20-
fixturePath
21-
);
21+
const cloudFormationUpdateTemplate = await readUpdateTemplate(fixturePath);
2222

2323
cloudFormationUpdateResources = cloudFormationUpdateTemplate.Resources;
2424
});

0 commit comments

Comments
 (0)