Skip to content

Commit 10c8d81

Browse files
authored
Merge branch 'master' into integration-category
2 parents 673bc0e + 098aaf5 commit 10c8d81

File tree

6 files changed

+82
-63
lines changed

6 files changed

+82
-63
lines changed

.github/workflows/publish.yml

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
# Triggers the workflow on push or pull request events but only for the "master" branch
88
push:
99
branches: [ "master" ]
10-
pull_request:
11-
branches: [ "master" ]
1210

1311
# Allows you to run this workflow manually from the Actions tab
1412
workflow_dispatch:

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ main();
2222
async function main() {
2323
// Search for products matching a certain string.
2424
const guestInfo = await MigrosAPI.account.oauth2.getGuestToken();
25-
const responseProductSearch = await MigrosAPI.products.productSearch.searchProduct({
25+
const responseProductSearch = await MigrosAPI.products.productSearch.searchProduct({
2626
query: "cooking salt",
2727
},
2828
{ leshopch: guestInfo.token })
@@ -40,9 +40,9 @@ async function main() {
4040
hl: "",
4141
TS012f1684: ""
4242
}
43-
// Get security options of your MigrosAPI Account
44-
const securityOptions = await MigrosAPI.account.security.getOptions(loginCookies)
45-
console.log(securityOptions)
43+
// Get security options of your MigrosAPI Account
44+
const securityOptions = await MigrosAPI.account.security.getOptions(loginCookies)
45+
console.log(securityOptions)
4646
}
4747
```
4848

package-lock.json

+21-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
},
5050
"dependencies": {
5151
"cheerio": "^1.0.0-rc.12",
52+
"dotenv": "^16.4.5",
5253
"pino": "^8.6.1",
5354
"pino-pretty": "^9.1.1"
5455
}

tests/cumulus-receipt.test.ts

+31-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
/* eslint-disable @typescript-eslint/naming-convention */
2-
import { describe, test } from "@jest/globals";
3-
// import { MigrosAPI } from "../src";
1+
import { describe, test, expect } from "@jest/globals";
2+
import { MigrosAPI } from "../src";
3+
import * as dotenv from "dotenv";
4+
import path from "path";
45

56
describe("Check for Migros Cumulus Receipt", () => {
67
test("Retrieve Cumulus Receipt", async () => {
7-
// const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
8-
// {
9-
// from: new Date("01.12.2023"),
10-
// to: new Date(),
11-
// },
12-
// {
13-
// ["cookie-banner-acceptance-state"]: "true",
14-
// JSESSIONID: responseSession["set-cookie"]["JSESSIONID"],
15-
// INGRESSCOOKIE: ".",
16-
// },
17-
// );
18-
// console.log(responseReceipts);
19-
// const response = await MigrosAPI.account.cumulus.getCumulusReceipt(
20-
// {
21-
// receiptId: responseReceipts[0].id,
22-
// },
23-
// {
24-
// JSESSIONID: responseSession["set-cookie"]["JSESSIONID"],
25-
// INGRESSCOOKIE: ".",
26-
// },
27-
// );
28-
// expect(response).toBe({});
8+
dotenv.config({ path: path.join(__dirname, "../.env") });
9+
if (!process.env.CUMULUS_JSESSIONID || !process.env.CUMULUS_INGRESSCOOKIE) {
10+
console.log("Please provide JSESSIONID and INGRESSCOOKIE in .env");
11+
return;
12+
}
13+
const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
14+
{
15+
from: new Date("01.12.2023"),
16+
to: new Date(),
17+
},
18+
{
19+
["cookie-banner-acceptance-state"]: "true",
20+
JSESSIONID: process.env.CUMULUS_JSESSIONID,
21+
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
22+
},
23+
);
24+
expect(responseReceipts).toBeInstanceOf(Array);
25+
const response = await MigrosAPI.account.cumulus.getCumulusReceipt(
26+
{
27+
receiptId: responseReceipts[0].id,
28+
},
29+
{
30+
JSESSIONID: process.env.CUMULUS_JSESSIONID,
31+
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
32+
},
33+
);
34+
expect(response).toHaveProperty("cumulus");
2935
});
3036
});

tests/cumulus-receipts.test.ts

+25-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
/* eslint-disable @typescript-eslint/naming-convention */
2-
import { describe, expect, test } from '@jest/globals';
3-
// import { MigrosAPI } from "../src";
1+
import { describe, expect, test } from "@jest/globals";
2+
import { MigrosAPI } from "../src";
3+
import * as dotenv from "dotenv";
4+
import path from "path";
45

5-
describe('Check for Migros Cumulus Receipts', () => {
6-
test('Retrieve Cumulus Receipts', async () => {
7-
/*
8-
const response = await MigrosAPI.account.cumulus.getCumulusReceipts({
9-
from: new Date("01.04.2022"),
10-
to: new Date()
11-
}, {
12-
"BIGipServerpool_shared_migros.ch_80": ".",
13-
"cookie-banner-acceptance-state": ".",
14-
"mo-fulfilmentOption": ".",
15-
"mo-lang": ".",
16-
"mo-securityContext": ".",
17-
"mo-sidebarsState": ".",
18-
JSESSIONID: ".",
19-
REALPERSON_SESSION: "."
20-
})
21-
*/
6+
describe("Check for Migros Cumulus Receipts", () => {
7+
test("Retrieve Cumulus Receipts", async () => {
8+
dotenv.config({ path: path.join(__dirname, "../.env") });
9+
if (!process.env.CUMULUS_JSESSIONID || !process.env.CUMULUS_INGRESSCOOKIE) {
10+
console.log("Please provide JSESSIONID and INGRESSCOOKIE in .env");
11+
return;
12+
}
13+
const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
14+
{
15+
from: new Date("01.12.2023"),
16+
to: new Date(),
17+
},
18+
{
19+
["cookie-banner-acceptance-state"]: "true",
20+
JSESSIONID: process.env.CUMULUS_JSESSIONID,
21+
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
22+
},
23+
);
24+
expect(responseReceipts).toBeInstanceOf(Array);
25+
});
26+
});
2227

23-
expect(null).toBe(null)
24-
});
25-
});

0 commit comments

Comments
 (0)