mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-09 01:30:05 +01:00
Fix lint
This commit is contained in:
parent
89af9e2f01
commit
d22069de0b
@ -1,3 +1,6 @@
|
||||
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package renderplugin
|
||||
|
||||
import (
|
||||
@ -50,7 +53,6 @@ func TestManifestNormalizeErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
m := base
|
||||
tt.mutate(&m)
|
||||
|
||||
@ -23,7 +23,6 @@ import (
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -69,7 +68,7 @@ func TestRenderPluginLifecycle(t *testing.T) {
|
||||
assert.Contains(t, flash.SuccessMsg, "disabled")
|
||||
row = requireRenderPluginRow(t, session, pluginID)
|
||||
assert.False(t, row.Enabled)
|
||||
require.Len(t, fetchRenderPluginMetadata(t), 0)
|
||||
require.Empty(t, fetchRenderPluginMetadata(t))
|
||||
|
||||
postPluginAction(t, session, fmt.Sprintf("/-/admin/render-plugins/%d/delete", row.ID))
|
||||
flash = expectFlashSuccess(t, session)
|
||||
|
||||
@ -3,24 +3,24 @@ import {describe, expect, it, vi} from 'vitest';
|
||||
import {decodeHeadChunk} from './file-view.ts';
|
||||
|
||||
describe('decodeHeadChunk', () => {
|
||||
it('returns null when input is empty', () => {
|
||||
expect(decodeHeadChunk(null)).toBeNull();
|
||||
expect(decodeHeadChunk('')).toBeNull();
|
||||
});
|
||||
it('returns null when input is empty', () => {
|
||||
expect(decodeHeadChunk(null)).toBeNull();
|
||||
expect(decodeHeadChunk('')).toBeNull();
|
||||
});
|
||||
|
||||
it('decodes base64 content into a Uint8Array', () => {
|
||||
const data = 'Gitea Render Plugin';
|
||||
const encoded = Buffer.from(data, 'utf-8').toString('base64');
|
||||
const decoded = decodeHeadChunk(encoded);
|
||||
expect(decoded).not.toBeNull();
|
||||
expect(new TextDecoder().decode(decoded!)).toBe(data);
|
||||
});
|
||||
it('decodes base64 content into a Uint8Array', () => {
|
||||
const data = 'Gitea Render Plugin';
|
||||
const encoded = Buffer.from(data, 'utf-8').toString('base64');
|
||||
const decoded = decodeHeadChunk(encoded);
|
||||
expect(decoded).not.toBeNull();
|
||||
expect(new TextDecoder().decode(decoded!)).toBe(data);
|
||||
});
|
||||
|
||||
it('logs and returns null for invalid input', () => {
|
||||
const spy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
||||
const result = decodeHeadChunk('%invalid-base64%');
|
||||
expect(result).toBeNull();
|
||||
expect(spy).toHaveBeenCalled();
|
||||
spy.mockRestore();
|
||||
});
|
||||
it('logs and returns null for invalid input', () => {
|
||||
const spy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
||||
const result = decodeHeadChunk('%invalid-base64%');
|
||||
expect(result).toBeNull();
|
||||
expect(spy).toHaveBeenCalled();
|
||||
spy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user