Skip to content

Commit 3e165a3

Browse files
committed
fix: package
1 parent 1518d87 commit 3e165a3

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

cypress/support/commands.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,28 @@ declare global {
2121
}
2222
}
2323

24-
Cypress.Commands.add('setUpApi', (database, appContext) => {
25-
Cypress.on('window:before:load', (win: Window) => {
26-
// win.indexedDB.deleteDatabase('graasp-app-cypress');
27-
// eslint-disable-next-line no-param-reassign
28-
win.appContext = {
29-
memberId: CURRENT_MEMBER.id,
30-
itemId: MOCK_SERVER_ITEM.id,
31-
apiHost: Cypress.env('VITE_API_HOST'),
32-
context: Context.Player,
33-
...appContext,
34-
};
35-
// eslint-disable-next-line no-param-reassign
36-
win.database = {
37-
appData: [],
38-
appActions: [],
39-
appSettings: [],
40-
members: Object.values(MEMBERS),
41-
items: [MOCK_SERVER_ITEM],
42-
...database,
43-
};
44-
});
45-
});
24+
Cypress.Commands.add(
25+
'setUpApi',
26+
(database: Partial<Database>, appContext: Partial<LocalContext>) => {
27+
Cypress.on('window:before:load', (win: Window) => {
28+
// win.indexedDB.deleteDatabase('graasp-app-cypress');
29+
// eslint-disable-next-line no-param-reassign
30+
win.appContext = {
31+
accountId: CURRENT_MEMBER.id,
32+
itemId: MOCK_SERVER_ITEM.id,
33+
apiHost: Cypress.env('VITE_API_HOST'),
34+
context: Context.Player,
35+
...appContext,
36+
};
37+
// eslint-disable-next-line no-param-reassign
38+
win.database = {
39+
appData: [],
40+
appActions: [],
41+
appSettings: [],
42+
members: Object.values(MEMBERS),
43+
items: [MOCK_SERVER_ITEM],
44+
...database,
45+
};
46+
});
47+
},
48+
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"hooks:install": "husky install",
6868
"hooks:uninstall": "husky uninstall",
6969
"pre-commit": "yarn prettier:check && yarn lint",
70-
"cypress:open": "env-cmd -f ./.env.development cypress open",
70+
"cypress:open": "env-cmd -f ./.env.test cypress open",
7171
"test": "concurrently -k -s first \"yarn start:test\" \"yarn test:ci\" ",
7272
"test:ci": "env-cmd -f ./.env.test cypress run && nyc report --reporter=text --reporter=text-summary",
7373
"cov:report": "open ./coverage/lcov-report/index.html"

0 commit comments

Comments
 (0)