Uncomment out expect statement

This commit is contained in:
Alex Holliday committed 2024-10-24 10:04:22 +08:00
1 parent 1c2d758e17
commit 47946cbf34
4 files changed
+22 -4

No files matched your search

+16 -1
View File
@@ -36,7 +36,7 @@ import { useSelector } from "react-redux";
import { CssBaseline } from "@mui/material";
import { useEffect } from "react";
import { useDispatch } from "react-redux";
import { getAppSettings } from "./Features/Settings/settingsSlice";
import { getAppSettings, updateAppSettings } from "./Features/Settings/settingsSlice";
import { logger } from "./Utils/Logger"; // Import the logger
import { networkService } from "./main";
function App() {
@@ -66,6 +66,21 @@ function App() {
};
}, []);
useEffect(() => {
const thing = async () => {
const action = await dispatch(
updateAppSettings({ authToken, settings: { apiBaseUrl: "test" } })
);
if (action.payload.success) {
console.log(action.payload.data);
} else {
console.log(action);
}
};
thing();
}, [dispatch, authToken]);
return (
<ThemeProvider theme={mode === "light" ? lightTheme : darkTheme}>
<CssBaseline />
@@ -49,6 +49,7 @@ export const updateAppSettings = createAsyncThunk(
systemEmailAddress: settings.systemEmailAddress,
systemEmailPassword: settings.systemEmailPassword,
};
console.log(parsedSettings);
const res = await networkService.updateAppSettings({
settings: parsedSettings,
authToken,
+3 -2
View File
@@ -13,6 +13,7 @@ class NetworkService {
this.setBaseUrl(baseURL);
this.unsubscribe = store.subscribe(() => {
const state = store.getState();
console.log(state.settings.apiBaseUrl);
if (BASE_URL !== undefined) {
baseURL = BASE_URL;
} else if (state?.settings?.apiBaseUrl ?? null) {
@@ -110,8 +111,8 @@ class NetworkService {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
}
})
},
});
}
/**
+2 -1
View File
@@ -1,5 +1,6 @@
import sinon from "sinon";
import JobQueue from "../../service/jobQueue.js";
import { log } from "console";
class QueueStub {
constructor(queueName, options) {
@@ -202,7 +203,7 @@ describe("JobQueue", () => {
);
const worker = jobQueue.createWorker();
await worker.workerTask();
// expect(networkService.getStatus.calledOnce).to.be.false;
expect(networkService.getStatus.calledOnce).to.be.true;
});
});
describe("getWorkerStats", () => {