fix: unit tests updated

This commit is contained in:
Eli Bosley
2025-01-19 22:21:04 -05:00
parent 58f65eabba
commit 0ab40fefda
5 changed files with 8 additions and 50 deletions

View File

@@ -9,8 +9,8 @@ upnpEnabled="no"
apikey="_______________________BIG_API_KEY_HERE_________________________"
localApiKey="_______________________LOCAL_API_KEY_HERE_________________________"
email="test@example.com"
username="https://via.placeholder.com/200"
avatar=""
username="zspearmint"
avatar="https://via.placeholder.com/200"
regWizTime="1611175408732_0951-1653-3509-FBA155FA23C0"
accesstoken=""
idtoken=""

View File

@@ -16,9 +16,6 @@ test('it creates a FLASH config with NO OPTIONAL values', () => {
"version": "",
},
"local": {},
"notifier": {
"apikey": "",
},
"remote": {
"accesstoken": "",
"apikey": "",
@@ -35,9 +32,6 @@ test('it creates a FLASH config with NO OPTIONAL values', () => {
"wanaccess": "",
"wanport": "",
},
"upc": {
"apikey": "",
},
}
`);
});
@@ -56,9 +50,6 @@ test('it creates a MEMORY config with NO OPTIONAL values', () => {
"upnpStatus": "",
},
"local": {},
"notifier": {
"apikey": "",
},
"remote": {
"accesstoken": "",
"allowedOrigins": "/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000",
@@ -76,9 +67,6 @@ test('it creates a MEMORY config with NO OPTIONAL values', () => {
"wanaccess": "",
"wanport": "",
},
"upc": {
"apikey": "",
},
}
`);
});
@@ -101,9 +89,6 @@ test('it creates a FLASH config with OPTIONAL values', () => {
"version": "",
},
"local": {},
"notifier": {
"apikey": "",
},
"remote": {
"accesstoken": "",
"apikey": "",
@@ -120,9 +105,6 @@ test('it creates a FLASH config with OPTIONAL values', () => {
"wanaccess": "",
"wanport": "",
},
"upc": {
"apikey": "",
},
}
`);
});
@@ -148,9 +130,6 @@ test('it creates a MEMORY config with OPTIONAL values', () => {
"upnpStatus": "Turned On",
},
"local": {},
"notifier": {
"apikey": "",
},
"remote": {
"accesstoken": "",
"allowedOrigins": "/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000",
@@ -168,9 +147,6 @@ test('it creates a MEMORY config with OPTIONAL values', () => {
"wanaccess": "",
"wanport": "",
},
"upc": {
"apikey": "",
},
}
`);
});

View File

@@ -4,20 +4,20 @@ import { store } from "@app/store/index";
import { expect, test } from "vitest";
test('get case path returns expected result', () => {
expect(getCasePathIfPresent()).resolves.toContain('/dev/dynamix/case-model.png')
test('get case path returns expected result', async () => {
await expect(getCasePathIfPresent()).resolves.toContain('/dev/dynamix/case-model.png')
})
test('get banner path returns null (state unloaded)', () => {
expect(getBannerPathIfPresent()).resolves.toMatchInlineSnapshot('null')
test('get banner path returns null (state unloaded)', async () => {
await expect(getBannerPathIfPresent()).resolves.toMatchInlineSnapshot('null')
})
test('get banner path returns the banner (state loaded)', async() => {
await store.dispatch(loadDynamixConfigFile()).unwrap();
expect(getBannerPathIfPresent()).resolves.toContain('/dev/dynamix/banner.png');
await expect(getBannerPathIfPresent()).resolves.toContain('/dev/dynamix/banner.png');
})
test('get banner path returns null when no banner (state loaded)', async () => {
await store.dispatch(loadDynamixConfigFile()).unwrap();
expect(getBannerPathIfPresent('notabanner.png')).resolves.toMatchInlineSnapshot('null');
await expect(getBannerPathIfPresent('notabanner.png')).resolves.toMatchInlineSnapshot('null');
});

View File

@@ -12,9 +12,6 @@ exports[`Before init returns default values for all fields 1`] = `
},
"local": {},
"nodeEnv": "test",
"notifier": {
"apikey": "",
},
"remote": {
"accesstoken": "",
"allowedOrigins": "",
@@ -33,8 +30,5 @@ exports[`Before init returns default values for all fields 1`] = `
"wanport": "",
},
"status": "UNLOADED",
"upc": {
"apikey": "",
},
}
`;

View File

@@ -28,9 +28,6 @@ test('After init returns values from cfg file for all fields', async () => {
},
local: {},
nodeEnv: 'test',
notifier: {
apikey: 'unnotify_30994bfaccf839c65bae75f7fa12dd5ee16e69389f754c3b98ed7d5',
},
remote: {
accesstoken: '',
allowedOrigins: '',
@@ -49,9 +46,6 @@ test('After init returns values from cfg file for all fields', async () => {
wanport: '8443',
},
status: 'LOADED',
upc: {
apikey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
},
})
);
});
@@ -82,9 +76,6 @@ test('updateUserConfig merges in changes to current state', async () => {
},
local: {},
nodeEnv: 'test',
notifier: {
apikey: 'unnotify_30994bfaccf839c65bae75f7fa12dd5ee16e69389f754c3b98ed7d5',
},
remote: {
accesstoken: '',
allowedOrigins: '',
@@ -103,9 +94,6 @@ test('updateUserConfig merges in changes to current state', async () => {
wanport: '8443',
},
status: 'LOADED',
upc: {
apikey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
},
} as MyServersConfigMemory)
);
});