Release 1.3.0

This commit is contained in:
2021-08-26 12:33:15 +02:00
commit 9bb72f0207
1148 changed files with 92133 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import * as Services from 'src/api/services';
import * as RPC from 'src/lib/rpc';
describe('src/api/services', () => {
beforeEach(() => {
spyOn(RPC, 'callMethod').and.resolveTo('ok');
});
describe('start', () => {
it('calls and RPC method to start a service', async () => {
// When
const result = await Services.start('FakeService', 'fake_instance', {
'spam': true,
});
// Then
expect(result).toEqual('ok');
expect(RPC.callMethod).toHaveBeenCalledWith('services.start', [
'FakeService', 'fake_instance', {'spam': true},
]);
});
});
describe('stop', () => {
it('calls and RPC method to stop a service', async () => {
// When
const result = await Services.stop('FakeService', 'fake_instance');
// Then
expect(result).toEqual('ok');
expect(RPC.callMethod).toHaveBeenCalledWith('services.stop', [
'FakeService', 'fake_instance',
]);
});
});
describe('use', () => {
it('calls and RPC method to use a service capability', async () => {
// When
const result = await Services.use(
'FakeService', 'fake_instance', 'testing', ['spam'],
);
// Then
expect(result).toEqual('ok');
expect(RPC.callMethod).toHaveBeenCalledWith('services.use', [
'FakeService', 'fake_instance', 'testing', ['spam'],
]);
});
});
});

View File

@@ -0,0 +1,32 @@
import * as State from 'src/api/state';
import * as RPC from 'src/lib/rpc';
describe('src/api/state', () => {
beforeEach(() => {
spyOn(RPC, 'callMethod').and.resolveTo('ok');
});
describe('get', () => {
it('calls and RPC method to get frontend state', async () => {
// When
const result = await State.get();
// Then
expect(result).toEqual('ok');
expect(RPC.callMethod).toHaveBeenCalledWith('state.get_frontend');
});
});
describe('save', () => {
it('calls and RPC method to save frontend state', async () => {
// When
const result = await State.save('spam');
// Then
expect(result).toEqual('ok');
expect(RPC.callMethod).toHaveBeenCalledWith(
'state.save_frontend', ['spam']
);
});
});
});