Skip to content

Commit c375d67

Browse files
Fixed osn_service tests
1 parent 8129183 commit c375d67

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
},
2626
"devDependencies": {
2727
"@types/chai": "^4.1.7",
28+
"@types/chai-subset": "^1.3.5",
2829
"@types/mocha": "^5.2.5",
2930
"@types/node": "^16.7.13",
3031
"archiver": "^3.1.1",
3132
"aws-sdk": "^2.1164.0",
3233
"chai": "^4.2.0",
34+
"chai-subset": "^1.6.0",
3335
"colors": "^1.4.0",
3436
"electron": "29.4.3",
3537
"electron-mocha": "^12.1.0",

tests/osn-tests/src/test_osn_service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { OBSHandler } from '../util/obs_handler'
77
import { deleteConfigFiles } from '../util/general';
88
import { EOBSInputTypes } from '../util/obs_enums';
99

10+
import chai = require('chai');
11+
import chaiSubset = require("chai-subset")
12+
chai.use(chaiSubset);
13+
1014
const testName = 'osn-service';
1115

1216
describe(testName, () => {
@@ -43,7 +47,7 @@ describe(testName, () => {
4347

4448
it('Get service types', () => {
4549
const services = osn.ServiceFactory.types();
46-
expect(services).to.eql(['rtmp_common', 'rtmp_custom'], 'Wrong services types returned');
50+
expect(services).to.eql(['whip_custom', 'rtmp_common', 'rtmp_custom'], 'Wrong services types returned');
4751
});
4852

4953
it('Create rtmp common', () => {
@@ -57,9 +61,9 @@ describe(testName, () => {
5761
key: 'test'
5862
});
5963

60-
expect(service.settings).to.eql(
61-
{service: 'Twitch', server: 'auto', key: 'test'},
62-
"Error while updating the service settings");
64+
// Using containSubset here because starting from OBS 30 the resulting object is bloated with URLs and disclaimers about usage policy
65+
expect(service.settings).to.containSubset(
66+
{service: 'Twitch', server: 'auto', key: 'test'});
6367

6468
const props = service.properties;
6569
let prop: any = props.first();

yarn.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@
3939
"@types/node" "*"
4040
"@types/responselike" "^1.0.0"
4141

42+
"@types/chai-subset@^1.3.5":
43+
version "1.3.5"
44+
resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.5.tgz#3fc044451f26985f45625230a7f22284808b0a9a"
45+
integrity sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==
46+
dependencies:
47+
"@types/chai" "*"
48+
49+
"@types/chai@*":
50+
version "5.0.0"
51+
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-5.0.0.tgz#7f981e71e69c9b2d422f58f78de1c59179782133"
52+
integrity sha512-+DwhEHAaFPPdJ2ral3kNHFQXnTfscEEFsUxzD+d7nlcLrFK23JtNjH71RGasTcHb88b4vVi4mTyfpf8u2L8bdA==
53+
4254
"@types/chai@^4.1.7":
4355
version "4.3.11"
4456
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.11.tgz#e95050bf79a932cb7305dd130254ccdf9bde671c"
@@ -443,6 +455,11 @@ caseless@~0.12.0:
443455
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
444456
integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==
445457

458+
chai-subset@^1.6.0:
459+
version "1.6.0"
460+
resolved "https://registry.yarnpkg.com/chai-subset/-/chai-subset-1.6.0.tgz#a5d0ca14e329a79596ed70058b6646bd6988cfe9"
461+
integrity sha512-K3d+KmqdS5XKW5DWPd5sgNffL3uxdDe+6GdnJh3AYPhwnBGRY5urfvfcbRtWIvvpz+KxkL9FeBB6MZewLUNwug==
462+
446463
chai@^4.2.0:
447464
version "4.3.10"
448465
resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.10.tgz#d784cec635e3b7e2ffb66446a63b4e33bd390384"

0 commit comments

Comments
 (0)