Skip to content

Commit 1259bd7

Browse files
authored
Merge 860039a into 049635c
2 parents 049635c + 860039a commit 1259bd7

File tree

8 files changed

+99
-327
lines changed

8 files changed

+99
-327
lines changed

cypress/e2e/actions.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { verifyFileSize } from './util';
1+
import { verifyFileSizeGreaterThan } from './util';
22
describe('Check actions', () => {
33
beforeEach(() => {
44
cy.clearLocalStorage();
@@ -28,20 +28,20 @@ describe('Check actions', () => {
2828
cy.clock(new Date(2022, 0, 1).getTime());
2929

3030
cy.get(`#downloadPNG`).click();
31-
verifyFileSize('diagram', 'png', 21_000);
31+
verifyFileSizeGreaterThan('diagram', 'png', 21_000);
3232

3333
cy.get(`#downloadSVG`).click();
34-
verifyFileSize('diagram', 'svg', 10_000);
34+
verifyFileSizeGreaterThan('diagram', 'svg', 10_000);
3535

3636
// Verify downloaded file is different for different diagrams
3737
cy.contains('Sample Diagrams').click();
3838
cy.contains('ER').click();
3939

4040
cy.get(`#downloadPNG`).click();
41-
verifyFileSize('diagram', 'png', 46_000);
41+
verifyFileSizeGreaterThan('diagram', 'png', 46_000);
4242

4343
cy.get(`#downloadSVG`).click();
44-
verifyFileSize('diagram', 'svg', 12_000);
44+
verifyFileSizeGreaterThan('diagram', 'svg', 11_000);
4545

4646
cy.clock().invoke('restore');
4747
});

cypress/e2e/util.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const getEditor = ({ bottom = true, newline = false } = {}) =>
1010

1111
const downloadsFolder = Cypress.config('downloadsFolder');
1212

13-
export const verifyFileSize = (
13+
export const verifyFileSizeGreaterThan = (
1414
fileType: 'history' | 'diagram',
1515
extension: string,
1616
size: number
@@ -21,7 +21,7 @@ export const verifyFileSize = (
2121
cy.verifyDownload(fileName);
2222
cy.readFile(filePath, null, {
2323
log: false
24-
}).then((buffer) => expect((buffer as ArrayBuffer).byteLength).to.be.gt(size));
24+
}).then((buffer: ArrayBuffer) => expect(buffer.byteLength).to.be.gt(size));
2525
cy.task('deleteFile', filePath);
2626
};
2727

@@ -36,8 +36,8 @@ export const verifyFileSnapshot = (
3636
cy.verifyDownload(fileName);
3737
cy.readFile(filePath, null, {
3838
log: false
39-
}).then((buffer) =>
40-
expect(new TextDecoder('utf-8').decode(buffer as ArrayBuffer)).to.contain(content)
39+
}).then((buffer: ArrayBuffer) =>
40+
expect(new TextDecoder('utf-8').decode(buffer)).to.contain(content)
4141
);
4242
cy.task('deleteFile', filePath);
4343
};

cypress/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"allowJs": true,
4-
"types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads"]
4+
"types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads", "node"]
55
},
66
"include": ["**/*.ts"]
77
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@
6767
"vitest": "^0.25.3"
6868
},
6969
"dependencies": {
70-
"@mermaid-js/mermaid-mindmap": "9.2.2",
70+
"@mermaid-js/mermaid-mindmap": "9.3.0",
7171
"analytics": "0.8.1",
7272
"analytics-plugin-plausible": "0.0.6",
7373
"daisyui": "2.42.1",
7474
"js-base64": "3.7.3",
75-
"mermaid": "9.2.2",
75+
"mermaid": "9.3.0",
7676
"moment": "2.29.4",
7777
"monaco-editor": "0.34.1",
7878
"monaco-mermaid": "1.0.8",

src/lib/components/Card/__snapshots__/card.test.ts.snap

-3
This file was deleted.

src/lib/components/Card/card.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ describe('card.svelte', () => {
1919
expect(container).toHaveTextContent('title1');
2020
expect(container).toHaveTextContent('title2');
2121
expect(container).not.toHaveTextContent('title3');
22-
expect(container.innerHTML).toMatchSnapshot();
2322
});
2423
});

vite.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { sveltekit } from '@sveltejs/kit/vite';
2-
/** @type {import('vite').UserConfig} */
3-
const config = {
2+
import { defineConfig } from 'vitest/config';
3+
4+
export default defineConfig({
45
plugins: [sveltekit()],
56
envPrefix: 'MERMAID_',
67
optimizeDeps: { include: ['mermaid'] },
@@ -22,5 +23,4 @@ const config = {
2223
reporter: ['text', 'json', 'html', 'lcov']
2324
}
2425
}
25-
};
26-
export default config;
26+
});

0 commit comments

Comments
 (0)