Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Oct 20, 2024
1 parent 453b1c2 commit ac1a860
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/util/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,6 @@ export function getGroup(IDorName: string | number): GroupOptions | undefined {
return undefined;
}

export function getGroups(): GroupOptions[] {
const settings = get();

return Object.entries(settings.groups).map(([ID, group]) => {
return {...group, ID: Number(ID)};
});
}

function getGroupThrowIfNotExists(IDorName: string): GroupOptions {
const group = getGroup(IDorName);

Expand Down
14 changes: 14 additions & 0 deletions test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,20 @@ describe('Settings', () => {
expect(group).toStrictEqual(expected);
});

it('Throw if removing non-existing group', () => {
const content = {
groups: {
1: {
friendly_name: '123',
},
},
};

write(configurationFile, content);

expect(() => settings.removeGroup('2')).toThrow(`Group '2' does not exist`);
});

it('Should read groups from a separate file', () => {
const contentConfiguration = {
groups: 'groups.yaml',
Expand Down

0 comments on commit ac1a860

Please sign in to comment.