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_________________________" apikey="_______________________BIG_API_KEY_HERE_________________________"
localApiKey="_______________________LOCAL_API_KEY_HERE_________________________" localApiKey="_______________________LOCAL_API_KEY_HERE_________________________"
email="test@example.com" email="test@example.com"
username="https://via.placeholder.com/200" username="zspearmint"
avatar="" avatar="https://via.placeholder.com/200"
regWizTime="1611175408732_0951-1653-3509-FBA155FA23C0" regWizTime="1611175408732_0951-1653-3509-FBA155FA23C0"
accesstoken="" accesstoken=""
idtoken="" idtoken=""

View File

@@ -16,9 +16,6 @@ test('it creates a FLASH config with NO OPTIONAL values', () => {
"version": "", "version": "",
}, },
"local": {}, "local": {},
"notifier": {
"apikey": "",
},
"remote": { "remote": {
"accesstoken": "", "accesstoken": "",
"apikey": "", "apikey": "",
@@ -35,9 +32,6 @@ test('it creates a FLASH config with NO OPTIONAL values', () => {
"wanaccess": "", "wanaccess": "",
"wanport": "", "wanport": "",
}, },
"upc": {
"apikey": "",
},
} }
`); `);
}); });
@@ -56,9 +50,6 @@ test('it creates a MEMORY config with NO OPTIONAL values', () => {
"upnpStatus": "", "upnpStatus": "",
}, },
"local": {}, "local": {},
"notifier": {
"apikey": "",
},
"remote": { "remote": {
"accesstoken": "", "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", "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": "", "wanaccess": "",
"wanport": "", "wanport": "",
}, },
"upc": {
"apikey": "",
},
} }
`); `);
}); });
@@ -101,9 +89,6 @@ test('it creates a FLASH config with OPTIONAL values', () => {
"version": "", "version": "",
}, },
"local": {}, "local": {},
"notifier": {
"apikey": "",
},
"remote": { "remote": {
"accesstoken": "", "accesstoken": "",
"apikey": "", "apikey": "",
@@ -120,9 +105,6 @@ test('it creates a FLASH config with OPTIONAL values', () => {
"wanaccess": "", "wanaccess": "",
"wanport": "", "wanport": "",
}, },
"upc": {
"apikey": "",
},
} }
`); `);
}); });
@@ -148,9 +130,6 @@ test('it creates a MEMORY config with OPTIONAL values', () => {
"upnpStatus": "Turned On", "upnpStatus": "Turned On",
}, },
"local": {}, "local": {},
"notifier": {
"apikey": "",
},
"remote": { "remote": {
"accesstoken": "", "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", "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": "", "wanaccess": "",
"wanport": "", "wanport": "",
}, },
"upc": {
"apikey": "",
},
} }
`); `);
}); });

View File

@@ -4,20 +4,20 @@ import { store } from "@app/store/index";
import { expect, test } from "vitest"; import { expect, test } from "vitest";
test('get case path returns expected result', () => { test('get case path returns expected result', async () => {
expect(getCasePathIfPresent()).resolves.toContain('/dev/dynamix/case-model.png') await expect(getCasePathIfPresent()).resolves.toContain('/dev/dynamix/case-model.png')
}) })
test('get banner path returns null (state unloaded)', () => { test('get banner path returns null (state unloaded)', async () => {
expect(getBannerPathIfPresent()).resolves.toMatchInlineSnapshot('null') await expect(getBannerPathIfPresent()).resolves.toMatchInlineSnapshot('null')
}) })
test('get banner path returns the banner (state loaded)', async() => { test('get banner path returns the banner (state loaded)', async() => {
await store.dispatch(loadDynamixConfigFile()).unwrap(); 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 () => { test('get banner path returns null when no banner (state loaded)', async () => {
await store.dispatch(loadDynamixConfigFile()).unwrap(); 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": {}, "local": {},
"nodeEnv": "test", "nodeEnv": "test",
"notifier": {
"apikey": "",
},
"remote": { "remote": {
"accesstoken": "", "accesstoken": "",
"allowedOrigins": "", "allowedOrigins": "",
@@ -33,8 +30,5 @@ exports[`Before init returns default values for all fields 1`] = `
"wanport": "", "wanport": "",
}, },
"status": "UNLOADED", "status": "UNLOADED",
"upc": {
"apikey": "",
},
} }
`; `;

View File

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