Skip to content

Commit

Permalink
Merge branch 'master' into integration-category
Browse files Browse the repository at this point in the history
  • Loading branch information
aliyss authored Sep 7, 2024
2 parents 673bc0e + 098aaf5 commit 10c8d81
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 63 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main();
async function main() {
// Search for products matching a certain string.
const guestInfo = await MigrosAPI.account.oauth2.getGuestToken();
const responseProductSearch = await MigrosAPI.products.productSearch.searchProduct({
const responseProductSearch = await MigrosAPI.products.productSearch.searchProduct({
query: "cooking salt",
},
{ leshopch: guestInfo.token })
Expand All @@ -40,9 +40,9 @@ async function main() {
hl: "",
TS012f1684: ""
}
// Get security options of your MigrosAPI Account
const securityOptions = await MigrosAPI.account.security.getOptions(loginCookies)
console.log(securityOptions)
// Get security options of your MigrosAPI Account
const securityOptions = await MigrosAPI.account.security.getOptions(loginCookies)
console.log(securityOptions)
}
```

Expand Down
30 changes: 21 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"cheerio": "^1.0.0-rc.12",
"dotenv": "^16.4.5",
"pino": "^8.6.1",
"pino-pretty": "^9.1.1"
}
Expand Down
56 changes: 31 additions & 25 deletions tests/cumulus-receipt.test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { describe, test } from "@jest/globals";
// import { MigrosAPI } from "../src";
import { describe, test, expect } from "@jest/globals";
import { MigrosAPI } from "../src";
import * as dotenv from "dotenv";
import path from "path";

describe("Check for Migros Cumulus Receipt", () => {
test("Retrieve Cumulus Receipt", async () => {
// const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
// {
// from: new Date("01.12.2023"),
// to: new Date(),
// },
// {
// ["cookie-banner-acceptance-state"]: "true",
// JSESSIONID: responseSession["set-cookie"]["JSESSIONID"],
// INGRESSCOOKIE: ".",
// },
// );
// console.log(responseReceipts);
// const response = await MigrosAPI.account.cumulus.getCumulusReceipt(
// {
// receiptId: responseReceipts[0].id,
// },
// {
// JSESSIONID: responseSession["set-cookie"]["JSESSIONID"],
// INGRESSCOOKIE: ".",
// },
// );
// expect(response).toBe({});
dotenv.config({ path: path.join(__dirname, "../.env") });
if (!process.env.CUMULUS_JSESSIONID || !process.env.CUMULUS_INGRESSCOOKIE) {
console.log("Please provide JSESSIONID and INGRESSCOOKIE in .env");
return;
}
const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
{
from: new Date("01.12.2023"),
to: new Date(),
},
{
["cookie-banner-acceptance-state"]: "true",
JSESSIONID: process.env.CUMULUS_JSESSIONID,
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
},
);
expect(responseReceipts).toBeInstanceOf(Array);
const response = await MigrosAPI.account.cumulus.getCumulusReceipt(
{
receiptId: responseReceipts[0].id,
},
{
JSESSIONID: process.env.CUMULUS_JSESSIONID,
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
},
);
expect(response).toHaveProperty("cumulus");
});
});
48 changes: 25 additions & 23 deletions tests/cumulus-receipts.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { describe, expect, test } from '@jest/globals';
// import { MigrosAPI } from "../src";
import { describe, expect, test } from "@jest/globals";
import { MigrosAPI } from "../src";
import * as dotenv from "dotenv";
import path from "path";

describe('Check for Migros Cumulus Receipts', () => {
test('Retrieve Cumulus Receipts', async () => {
/*
const response = await MigrosAPI.account.cumulus.getCumulusReceipts({
from: new Date("01.04.2022"),
to: new Date()
}, {
"BIGipServerpool_shared_migros.ch_80": ".",
"cookie-banner-acceptance-state": ".",
"mo-fulfilmentOption": ".",
"mo-lang": ".",
"mo-securityContext": ".",
"mo-sidebarsState": ".",
JSESSIONID: ".",
REALPERSON_SESSION: "."
})
*/
describe("Check for Migros Cumulus Receipts", () => {
test("Retrieve Cumulus Receipts", async () => {
dotenv.config({ path: path.join(__dirname, "../.env") });
if (!process.env.CUMULUS_JSESSIONID || !process.env.CUMULUS_INGRESSCOOKIE) {
console.log("Please provide JSESSIONID and INGRESSCOOKIE in .env");
return;
}
const responseReceipts = await MigrosAPI.account.cumulus.getCumulusReceipts(
{
from: new Date("01.12.2023"),
to: new Date(),
},
{
["cookie-banner-acceptance-state"]: "true",
JSESSIONID: process.env.CUMULUS_JSESSIONID,
INGRESSCOOKIE: process.env.CUMULUS_INGRESSCOOKIE,
},
);
expect(responseReceipts).toBeInstanceOf(Array);
});
});

expect(null).toBe(null)
});
});

0 comments on commit 10c8d81

Please sign in to comment.