Nocigar commited on
Commit
fccbfd0
·
verified ·
1 Parent(s): 1307964

Upload 6 files

Browse files
tests/.eslintrc.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ root: true,
3
+ plugins: [
4
+ 'jest',
5
+ ],
6
+ extends: [
7
+ 'eslint:recommended',
8
+ ],
9
+ env: {
10
+ es6: true,
11
+ node: true,
12
+ "jest/globals": true,
13
+ },
14
+ parserOptions: {
15
+ ecmaVersion: 'latest',
16
+ },
17
+ overrides: [
18
+ ],
19
+ ignorePatterns: [
20
+ ],
21
+ rules: {
22
+ 'no-unused-vars': ['error', { args: 'none' }],
23
+ 'no-control-regex': 'off',
24
+ 'no-constant-condition': ['error', { checkLoops: false }],
25
+ 'require-yield': 'off',
26
+ 'quotes': ['error', 'single'],
27
+ 'semi': ['error', 'always'],
28
+ 'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
29
+ 'comma-dangle': ['error', 'always-multiline'],
30
+ 'eol-last': ['error', 'always'],
31
+ 'no-trailing-spaces': 'error',
32
+ 'object-curly-spacing': ['error', 'always'],
33
+ 'space-infix-ops': 'error',
34
+ 'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
35
+ 'no-cond-assign': 'error',
36
+ },
37
+ };
tests/jest.config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "verbose": true,
3
+ "transform": {},
4
+ "extensionsToTreatAsEsm": [],
5
+ "preset": "jest-puppeteer",
6
+ "setupFilesAfterEnv": [
7
+ "<rootDir>/jest.setup.js"
8
+ ]
9
+ }
tests/jest.setup.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ // Initialize global variables for Jest tests here
2
+ global.ST_URL = 'http://localhost:8000';
tests/package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
tests/package.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "sillytavern-tests",
3
+ "type": "module",
4
+ "license": "AGPL-3.0",
5
+ "scripts": {
6
+ "test": "jest"
7
+ },
8
+ "dependencies": {
9
+ "@types/jest": "^29.5.12",
10
+ "eslint": "^8.57.0",
11
+ "eslint-plugin-jest": "^28.6.0",
12
+ "jest": "^29.7.0",
13
+ "jest-puppeteer": "^10.0.1"
14
+ }
15
+ }
tests/sample.test.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ describe('sample', () => {
2
+ beforeAll(async () => {
3
+ await page.goto(global.ST_URL);
4
+ await page.waitForFunction('document.getElementById("preloader") === null', { timeout: 0 });
5
+ });
6
+
7
+ it('should be titled "SillyTavern"', async () => {
8
+ await expect(page.title()).resolves.toMatch('SillyTavern');
9
+ });
10
+ });