Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.3.0 #1119

Merged
merged 14 commits into from
Dec 15, 2022
10 changes: 5 additions & 5 deletions cypress/e2e/actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { verifyFileSize } from './util';
import { verifyFileSizeGreaterThan } from './util';
describe('Check actions', () => {
beforeEach(() => {
cy.clearLocalStorage();
Expand Down Expand Up @@ -28,20 +28,20 @@ describe('Check actions', () => {
cy.clock(new Date(2022, 0, 1).getTime());

cy.get(`#downloadPNG`).click();
verifyFileSize('diagram', 'png', 21_000);
verifyFileSizeGreaterThan('diagram', 'png', 21_000);

cy.get(`#downloadSVG`).click();
verifyFileSize('diagram', 'svg', 10_000);
verifyFileSizeGreaterThan('diagram', 'svg', 10_000);

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

cy.get(`#downloadPNG`).click();
verifyFileSize('diagram', 'png', 46_000);
verifyFileSizeGreaterThan('diagram', 'png', 46_000);

cy.get(`#downloadSVG`).click();
verifyFileSize('diagram', 'svg', 12_000);
verifyFileSizeGreaterThan('diagram', 'svg', 11_000);

cy.clock().invoke('restore');
});
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getEditor = ({ bottom = true, newline = false } = {}) =>

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

export const verifyFileSize = (
export const verifyFileSizeGreaterThan = (
fileType: 'history' | 'diagram',
extension: string,
size: number
Expand All @@ -21,7 +21,7 @@ export const verifyFileSize = (
cy.verifyDownload(fileName);
cy.readFile(filePath, null, {
log: false
}).then((buffer) => expect((buffer as ArrayBuffer).byteLength).to.be.gt(size));
}).then((buffer: ArrayBuffer) => expect(buffer.byteLength).to.be.gt(size));
cy.task('deleteFile', filePath);
};

Expand All @@ -36,8 +36,8 @@ export const verifyFileSnapshot = (
cy.verifyDownload(fileName);
cy.readFile(filePath, null, {
log: false
}).then((buffer) =>
expect(new TextDecoder('utf-8').decode(buffer as ArrayBuffer)).to.contain(content)
}).then((buffer: ArrayBuffer) =>
expect(new TextDecoder('utf-8').decode(buffer)).to.contain(content)
);
cy.task('deleteFile', filePath);
};
2 changes: 1 addition & 1 deletion cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"allowJs": true,
"types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads"]
"types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads", "node"]
},
"include": ["**/*.ts"]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
"vitest": "^0.25.3"
},
"dependencies": {
"@mermaid-js/mermaid-mindmap": "9.2.2",
"@mermaid-js/mermaid-mindmap": "9.3.0",
"analytics": "0.8.1",
"analytics-plugin-plausible": "0.0.6",
"daisyui": "2.42.1",
"js-base64": "3.7.3",
"mermaid": "9.2.2",
"mermaid": "9.3.0",
"moment": "2.29.4",
"monaco-editor": "0.34.1",
"monaco-mermaid": "1.0.8",
Expand Down
3 changes: 0 additions & 3 deletions src/lib/components/Card/__snapshots__/card.test.ts.snap

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/components/Card/card.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ describe('card.svelte', () => {
expect(container).toHaveTextContent('title1');
expect(container).toHaveTextContent('title2');
expect(container).not.toHaveTextContent('title3');
expect(container.innerHTML).toMatchSnapshot();
});
});
8 changes: 4 additions & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
/** @type {import('vite').UserConfig} */
const config = {
import { defineConfig } from 'vitest/config';

export default defineConfig({
plugins: [sveltekit()],
envPrefix: 'MERMAID_',
optimizeDeps: { include: ['mermaid'] },
Expand All @@ -22,5 +23,4 @@ const config = {
reporter: ['text', 'json', 'html', 'lcov']
}
}
};
export default config;
});
Loading