Skip to content

Commit

Permalink
Merge branch 'production' into beta
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/platform/platform-cache/test/cache.integration.spec.ts
  • Loading branch information
Romakita committed Mar 5, 2025
2 parents b8eaf30 + 4d80d83 commit 7c63479
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
18 changes: 12 additions & 6 deletions packages/platform/platform-cache/test/cache.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe("Cache", () => {
beforeEach(
PlatformTest.bootstrap(Server, {
adapter: PlatformExpress,
logger: {},
mount: {
"/rest": [TestCacheController]
},
Expand All @@ -96,13 +97,12 @@ describe("Cache", () => {
}
})
);
beforeEach(() => {
request = SuperTest(PlatformTest.callback());
});
beforeEach(() => {});
afterEach(PlatformTest.reset);

describe("scenario 1: GET /rest/caches/scenario-1", () => {
it("should return data with cached response", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-1").expect(200);
const response2 = await request.get("/rest/caches/scenario-1").expect(200);

Expand All @@ -117,6 +117,7 @@ describe("Cache", () => {
});

it("should return 304 when content isn't modified", async () => {
const request = SuperTest(PlatformTest.callback());
const platformCache = PlatformTest.get<PlatformCache>(PlatformCache);

const response = await request.get("/rest/caches/scenario-1").expect(200);
Expand All @@ -129,6 +130,7 @@ describe("Cache", () => {
});

it("should return fresh data if cache-control is set to no-cache", async () => {
const request = SuperTest(PlatformTest.callback());
await request.get("/rest/caches/scenario-1").expect(200);
const response2 = await request.get("/rest/caches/scenario-1").set("cache-control", "no-cache").expect(200);

Expand All @@ -140,6 +142,7 @@ describe("Cache", () => {
});
describe("scenario 2: GET /rest/caches/scenario-2", () => {
it("should return data with cached response", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-2").expect(200);
const response2 = await request.get("/rest/caches/scenario-2").expect(200);

Expand All @@ -155,6 +158,7 @@ describe("Cache", () => {
});
describe("scenario 4: POST /rest/caches/scenario-4", () => {
it("should not cache POST method", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.post("/rest/caches/scenario-4").expect(200);
const response2 = await request.post("/rest/caches/scenario-4").expect(200);

Expand All @@ -174,6 +178,7 @@ describe("Cache", () => {
});
describe("scenario 5: GET /rest/caches/scenario-5", () => {
it("should return data with then cache response", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-5/1?name=1").expect(200);
const response2 = await request.get("/rest/caches/scenario-5/1?name=1").expect(200);
const response3 = await request.get("/rest/caches/scenario-5/2?name=2").expect(200);
Expand Down Expand Up @@ -214,6 +219,7 @@ describe("Cache", () => {
});
describe("scenario 6: GET /rest/caches/scenario-6", () => {
it("should return data from cached service", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-6/1").expect(200);
const response2 = await request.get("/rest/caches/scenario-6/2").expect(200);

Expand All @@ -226,6 +232,7 @@ describe("Cache", () => {
});
describe("scenario 7: GET /rest/caches/scenario-7", () => {
it("should return data from cached service", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-7/1").expect(200);
const response2 = await request.get("/rest/caches/scenario-7/2").expect(200);
const response3 = await request.get("/rest/caches/scenario-7/2").expect(200);
Expand All @@ -244,20 +251,19 @@ describe("Cache", () => {
describe("withoutCache", () => {
beforeEach(
PlatformTest.bootstrap(Server, {
adapter: PlatformExpress,
logger: {},
cache: false,
mount: {
"/rest": [TestCacheController]
}
})
);
beforeEach(() => {
request = SuperTest(PlatformTest.callback());
});
afterEach(PlatformTest.reset);

describe("scenario 1: GET /rest/caches/scenario-1", () => {
it("should return data with cached response", async () => {
const request = SuperTest(PlatformTest.callback());
const response = await request.get("/rest/caches/scenario-1").expect(200);
const response2 = await request.get("/rest/caches/scenario-1").expect(200);

Expand Down
2 changes: 1 addition & 1 deletion packages/specs/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@tsed/openspec": "workspace:*",
"change-case": "^5.4.4",
"json-schema": "0.4.0",
"picomatch": "2.3.1",
"picomatch": "4.0.2",
"statuses": "^2.0.1",
"tslib": "2.7.0"
},
Expand Down
11 changes: 9 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8652,7 +8652,7 @@ __metadata:
change-case: "npm:^5.4.4"
eslint: "npm:9.12.0"
json-schema: "npm:0.4.0"
picomatch: "npm:2.3.1"
picomatch: "npm:4.0.2"
picomatch-browser: "npm:^2.2.6"
statuses: "npm:^2.0.1"
tslib: "npm:2.7.0"
Expand Down Expand Up @@ -24902,7 +24902,14 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:2.3.1, picomatch@npm:^2.0.4, picomatch@npm:^2.0.5, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1":
"picomatch@npm:4.0.2":
version: 4.0.2
resolution: "picomatch@npm:4.0.2"
checksum: 10/ce617b8da36797d09c0baacb96ca8a44460452c89362d7cb8f70ca46b4158ba8bc3606912de7c818eb4a939f7f9015cef3c766ec8a0c6bfc725fdc078e39c717
languageName: node
linkType: hard

"picomatch@npm:^2.0.4, picomatch@npm:^2.0.5, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1":
version: 2.3.1
resolution: "picomatch@npm:2.3.1"
checksum: 10/60c2595003b05e4535394d1da94850f5372c9427ca4413b71210f437f7b2ca091dbd611c45e8b37d10036fa8eade25c1b8951654f9d3973bfa66a2ff4d3b08bc
Expand Down

0 comments on commit 7c63479

Please sign in to comment.