Skip to content

Commit 7a6dd63

Browse files
author
mdatelle
committed
test: rename test folder and move helper tests with rest of test suite
1 parent e22c9c6 commit 7a6dd63

File tree

18 files changed

+39
-30
lines changed

18 files changed

+39
-30
lines changed

.cursor/rules/web-testing-rules.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description:
3-
globs: **/*.test.ts,**/test/components/**/*.ts,**/test/store/**/*.ts,**/test/mocks/**/*.ts
3+
globs: **/*.test.ts,**/__test__/components/**/*.ts,**/__test__/store/**/*.ts,**/__test__/mocks/**/*.ts
44
alwaysApply: false
55
---
66

File renamed without changes.

web/test/components/KeyActions.test.ts renamed to web/__test__/components/KeyActions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { ServerStateDataAction, ServerStateDataActionType } from '~/types/s
1313

1414
import KeyActions from '../../components/KeyActions.vue';
1515

16-
import '~/test/mocks/ui-components';
16+
import '~/__test__/mocks/ui-components';
1717

1818
// Create mock store actions
1919
const storeKeyActions = [
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`sanitization > strips javascript 1`] = `
4+
"<p><img src="x"></p>
5+
"
6+
`;
7+
8+
exports[`sanitization > strips javascript 2`] = `
9+
"<p><img src="x"></p>
10+
"
11+
`;

web/helpers/apollo-cache/merge.test.ts renamed to web/__test__/helpers/apollo-cache/merge.test.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { describe, it, expect } from "vitest";
1+
import { mergeAndDedup } from '~/helpers/apollo-cache/merge';
2+
import { describe, expect, it } from 'vitest';
23

3-
import { mergeAndDedup, type ApolloCacheItem } from "./merge";
4+
import type { ApolloCacheItem } from '~/helpers/apollo-cache/merge';
45

5-
describe("mergeAndDedup", () => {
6+
describe('mergeAndDedup', () => {
67
const createRef = (id: unknown) => ({ __ref: `Post:${id}` });
78
const getRef = (item: ApolloCacheItem) => item.__ref;
89

9-
describe("basic functionality", () => {
10-
it("should concatenate when there are no duplicates", () => {
10+
describe('basic functionality', () => {
11+
it('should concatenate when there are no duplicates', () => {
1112
const existing = [createRef(1), createRef(2), createRef(3)];
1213
const incoming = [createRef(4), createRef(5)];
1314

@@ -24,7 +25,7 @@ describe("mergeAndDedup", () => {
2425
]);
2526
});
2627

27-
it("should merge without duplicates when offset is 0", () => {
28+
it('should merge without duplicates when offset is 0', () => {
2829
const existing = [createRef(1), createRef(2), createRef(3)];
2930

3031
const incoming = [
@@ -40,7 +41,7 @@ describe("mergeAndDedup", () => {
4041
]);
4142
});
4243

43-
it("should merge without duplicates when offset > 0", () => {
44+
it('should merge without duplicates when offset > 0', () => {
4445
const existing = [createRef(1), createRef(2), createRef(3), createRef(5)];
4546

4647
const incoming = [
@@ -58,7 +59,7 @@ describe("mergeAndDedup", () => {
5859
]);
5960
});
6061

61-
it("should handle duplicates > range of replacement", () => {
62+
it('should handle duplicates > range of replacement', () => {
6263
const existing = [createRef(1), createRef(2), createRef(3), createRef(4), createRef(2)];
6364

6465
const incoming = [
@@ -75,7 +76,7 @@ describe("mergeAndDedup", () => {
7576
]);
7677
});
7778

78-
it("should handle duplicate < range of replacement", () => {
79+
it('should handle duplicate < range of replacement', () => {
7980
const existing = [createRef(4), createRef(2), createRef(3), createRef(1)];
8081

8182
const incoming = [
@@ -93,8 +94,8 @@ describe("mergeAndDedup", () => {
9394
});
9495
});
9596

96-
describe("edge cases", () => {
97-
it("should handle empty existing array", () => {
97+
describe('edge cases', () => {
98+
it('should handle empty existing array', () => {
9899
const existing = [] as ApolloCacheItem[];
99100
const incoming = [createRef(1), createRef(2)];
100101

@@ -103,7 +104,7 @@ describe("mergeAndDedup", () => {
103104
expect(result).toEqual([createRef(1), createRef(2)]);
104105
});
105106

106-
it("should handle empty incoming array", () => {
107+
it('should handle empty incoming array', () => {
107108
const existing = [createRef(1), createRef(2)];
108109
const incoming: ApolloCacheItem[] = [];
109110

@@ -112,15 +113,15 @@ describe("mergeAndDedup", () => {
112113
expect(result).toEqual(existing);
113114
});
114115

115-
it("should handle undefined existing array", () => {
116+
it('should handle undefined existing array', () => {
116117
const incoming = [createRef(1), createRef(2)];
117118

118119
const result = mergeAndDedup(undefined, incoming, getRef, { offset: 0 });
119120

120121
expect(result).toEqual(incoming);
121122
});
122123

123-
it("should handle undefined args", () => {
124+
it('should handle undefined args', () => {
124125
const existing = [createRef(1)];
125126
const incoming = [createRef(2)];
126127

@@ -129,7 +130,7 @@ describe("mergeAndDedup", () => {
129130
expect(result).toEqual([createRef(2)]);
130131
});
131132

132-
it("should handle offset larger than existing array", () => {
133+
it('should handle offset larger than existing array', () => {
133134
const existing = [createRef(1)];
134135
const incoming = [createRef(2)];
135136

@@ -139,8 +140,8 @@ describe("mergeAndDedup", () => {
139140
});
140141
});
141142

142-
describe("multiple duplicates", () => {
143-
it("should not overwrite multiple duplicates in incoming data", () => {
143+
describe('multiple duplicates', () => {
144+
it('should not overwrite multiple duplicates in incoming data', () => {
144145
const existing = [createRef(1), createRef(2), createRef(3)];
145146

146147
const incoming = [
@@ -154,7 +155,7 @@ describe("mergeAndDedup", () => {
154155
expect(result).toEqual([createRef(2), createRef(3), createRef(2)]);
155156
});
156157

157-
it("should handle duplicates with gaps in offset", () => {
158+
it('should handle duplicates with gaps in offset', () => {
158159
const existing = [createRef(1), createRef(2), createRef(3), createRef(4)];
159160

160161
const incoming = [

web/helpers/markdown.test.ts renamed to web/__test__/helpers/markdown.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Markdown } from '~/helpers/markdown';
12
import { baseUrl } from 'marked-base-url';
23
import { describe, expect, test } from 'vitest';
3-
import { Markdown } from './markdown';
44

55
// add a random extension to the instance
66
const instance = Markdown.create(baseUrl('https://unraid.net'));
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)