mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify test
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
e9a851a8cb
commit
552df3155b
@ -1,36 +1,6 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`installing update from update channels given no update channel selection is stored, when started renders 1`] = `
|
exports[`installing update from update channels when started renders 1`] = `
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="Notifications flex column align-flex-end"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates renders 1`] = `
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="Notifications flex column align-flex-end"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates when new update is discovered renders 1`] = `
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
class="Notifications flex column align-flex-end"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates when new update is discovered when download succeeds renders 1`] = `
|
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -71,7 +71,7 @@ describe("installing update from update channels", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("given no update channel selection is stored, when started", () => {
|
describe("when started", () => {
|
||||||
let rendered: RenderResult;
|
let rendered: RenderResult;
|
||||||
let checkForUpdates: () => Promise<void>;
|
let checkForUpdates: () => Promise<void>;
|
||||||
|
|
||||||
@ -85,50 +85,6 @@ describe("installing update from update channels", () => {
|
|||||||
expect(rendered.baseElement).toMatchSnapshot();
|
expect(rendered.baseElement).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when user checks for updates", () => {
|
|
||||||
let checkForUpdatesPromise: Promise<void>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
checkForUpdatesPromise = checkForUpdates();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checks for updates from "latest" update channel by default', () => {
|
|
||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
|
||||||
updateChannels.latest,
|
|
||||||
{ allowDowngrade: true },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders", () => {
|
|
||||||
expect(rendered.baseElement).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("when new update is discovered", () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await checkForPlatformUpdatesMock.resolve({
|
|
||||||
updateWasDiscovered: true,
|
|
||||||
version: "some-version",
|
|
||||||
});
|
|
||||||
|
|
||||||
await checkForUpdatesPromise;
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders", () => {
|
|
||||||
expect(rendered.baseElement).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("when download succeeds", () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders", () => {
|
|
||||||
expect(rendered.baseElement).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('given update channel "alpha" is selected, when checking for updates', () => {
|
describe('given update channel "alpha" is selected, when checking for updates', () => {
|
||||||
let selectedUpdateChannel: {
|
let selectedUpdateChannel: {
|
||||||
value: IComputedValue<UpdateChannel>;
|
value: IComputedValue<UpdateChannel>;
|
||||||
@ -309,6 +265,23 @@ describe("installing update from update channels", () => {
|
|||||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('given no update channel selection is stored and currently using stable release, when user checks for updates, checks for updates from "latest" update channel by default', async () => {
|
||||||
|
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||||
|
mainDi.override(appVersionInjectable, () => "1.0.0");
|
||||||
|
});
|
||||||
|
|
||||||
|
await applicationBuilder.render();
|
||||||
|
|
||||||
|
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||||
|
|
||||||
|
checkForUpdates();
|
||||||
|
|
||||||
|
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||||
|
updateChannels.latest,
|
||||||
|
{ allowDowngrade: true },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
|
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
|
||||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||||
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user