summaryrefslogtreecommitdiff
path: root/test/playwright
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-10 23:12:01 -0500
committerGitHub <noreply@github.com>2024-02-11 04:12:01 +0000
commit765f1ede668f70e3af7717bf4d5f05dbf009c7f8 (patch)
treee73f481c93f8bbaa42f7c8216190fb1cb4621301 /test/playwright
parent805cf9cb3ea744a6d7c0a5da27fc9ef4e6f08626 (diff)
Eslint rule updates (#665)
* Padding newline rules * Update rules * Update rules * Update rules * Updates * Update object quotes * Merge similar ts and js rules * Change export spacing rules * Move typescript-eslint rules * Spacing * Actually save and commit changes
Diffstat (limited to 'test/playwright')
-rw-r--r--test/playwright/playwright-util.js57
1 files changed, 33 insertions, 24 deletions
diff --git a/test/playwright/playwright-util.js b/test/playwright/playwright-util.js
index bf171251..b364c80b 100644
--- a/test/playwright/playwright-util.js
+++ b/test/playwright/playwright-util.js
@@ -20,6 +20,7 @@ import path from 'path';
import {fileURLToPath} from 'url';
const dirname = path.dirname(fileURLToPath(import.meta.url));
+
export const root = path.join(dirname, '..', '..');
export const test = base.extend({
@@ -47,6 +48,7 @@ export const test = base.extend({
await use(extensionId);
}
});
+
export const expect = test.expect;
export const mockModelFieldNames = [
@@ -58,10 +60,10 @@ export const mockModelFieldNames = [
/** @type {{[key: string]: string|undefined}} */
export const mockModelFieldsToAnkiValues = {
- 'Word': '{expression}',
- 'Reading': '{furigana-plain}',
- 'Sentence': '{clipboard-text}',
- 'Audio': '{audio}'
+ Word: '{expression}',
+ Reading: '{furigana-plain}',
+ Sentence: '{clipboard-text}',
+ Audio: '{audio}'
};
/**
@@ -87,23 +89,30 @@ export const writeToClipboardFromPage = async (page, text) => {
};
export const expectedAddNoteBody = {
- 'action': 'addNote',
- 'params':
- {
- 'note': {
- 'fields': {
- 'Word': '読む', 'Reading': '読[よ]む', 'Audio': '[sound:mock_audio.mp3]', 'Sentence': '読むの例文'
+ version: 2,
+ action: 'addNote',
+ params: {
+ note: {
+ fields: {
+ Word: '読む',
+ Reading: '読[よ]む',
+ Audio: '[sound:mock_audio.mp3]',
+ Sentence: '読むの例文'
},
- 'tags': ['yomitan'],
- 'deckName': 'Mock Deck',
- 'modelName': 'Mock Model',
- 'options': {
- 'allowDuplicate': false, 'duplicateScope': 'collection', 'duplicateScopeOptions': {
- 'deckName': null, 'checkChildren': false, 'checkAllModels': false
+ tags: ['yomitan'],
+ deckName: 'Mock Deck',
+ modelName: 'Mock Model',
+ options: {
+ allowDuplicate: false,
+ duplicateScope: 'collection',
+ duplicateScopeOptions: {
+ deckName: null,
+ checkChildren: false,
+ checkAllModels: false
}
}
}
- }, 'version': 2
+ }
};
const baseAnkiResp = {
@@ -113,11 +122,11 @@ const baseAnkiResp = {
/** @type {{[key: string]: import('core').SerializableObject}} */
const ankiRouteResponses = {
- 'version': Object.assign({body: JSON.stringify(6)}, baseAnkiResp),
- 'deckNames': Object.assign({body: JSON.stringify(['Mock Deck'])}, baseAnkiResp),
- 'modelNames': Object.assign({body: JSON.stringify(['Mock Model'])}, baseAnkiResp),
- 'modelFieldNames': Object.assign({body: JSON.stringify(mockModelFieldNames)}, baseAnkiResp),
- 'canAddNotes': Object.assign({body: JSON.stringify([true, true])}, baseAnkiResp),
- 'storeMediaFile': Object.assign({body: JSON.stringify('mock_audio.mp3')}, baseAnkiResp),
- 'addNote': Object.assign({body: JSON.stringify(102312488912)}, baseAnkiResp)
+ version: Object.assign({body: JSON.stringify(6)}, baseAnkiResp),
+ deckNames: Object.assign({body: JSON.stringify(['Mock Deck'])}, baseAnkiResp),
+ modelNames: Object.assign({body: JSON.stringify(['Mock Model'])}, baseAnkiResp),
+ modelFieldNames: Object.assign({body: JSON.stringify(mockModelFieldNames)}, baseAnkiResp),
+ canAddNotes: Object.assign({body: JSON.stringify([true, true])}, baseAnkiResp),
+ storeMediaFile: Object.assign({body: JSON.stringify('mock_audio.mp3')}, baseAnkiResp),
+ addNote: Object.assign({body: JSON.stringify(102312488912)}, baseAnkiResp)
};