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

Small fixes #235

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ const updateBadgeColors = () => {

const spawnBalloon = async () => {
log.groupCollapsed(
'info',
'debug',
`(${new Date().toLocaleTimeString()}) Spawning Balloon...`
);
log.time('info', 'Spawn Time');
log.time('debug', 'Spawn Time');

const now = Date.now();
const minSpawnInterval = (await storage.sync.get('config')).spawnInterval
.min;
const skipSpawnMessage = (note: any, level: LogLevelNames = 'softwarn') => {
log[level](`Skipping spawnBalloon message: \r\n\t`, note);
log.timeEnd('info', 'Spawn Time');
log.groupEnd('info');
log.timeEnd('debug', 'Spawn Time');
log.groupEnd('debug');
};

// Check if there is a spawn timeout
Expand Down Expand Up @@ -165,8 +165,8 @@ const updateBadgeColors = () => {
log.softerror(' - Error sending spawn balloon script to tab', tab.id, e);
}
lastSpawn = now;
log.timeEnd('info', 'Spawn Time');
log.groupEnd('info');
log.timeEnd('debug', 'Spawn Time');
log.groupEnd('debug');
};

const createSpawnAlarm = async (name: AlarmName) => {
Expand Down
2 changes: 1 addition & 1 deletion src/popup/components/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default () => {
<span className="flex-grow">
<Caption />
</span>
{data.rank && (
{data.rank && data.rank <= limit * maxPages && (
<Tooltip>
<TooltipTrigger asChild>
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export async function importStylesheet(id: string, href: string) {
style.textContent = css;

// Append the <style> element to the <head>
document.head.appendChild(style);
getBalloonContainer().appendChild(style);
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/balloons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ describe('Balloons', () => {
test('all balloons have a corresponding test file', () => {
balloonNames.forEach((name) => {
const testName = `${name}.test.ts`;
expect(fs.existsSync(path.resolve(__dirname, `./balloons/${testName}`)));
expect(
fs.existsSync(path.resolve(__dirname, `./balloons/${testName}`))
).toBeTruthy();
});
});

Expand Down
23 changes: 23 additions & 0 deletions tests/balloons/confetti.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Confetti } from '@/balloons';
import fetchMock from 'jest-fetch-mock';

fetchMock.enableMocks();

describe('Confetti Balloon', () => {
let balloon: Confetti;

beforeEach(() => {
balloon = new Confetti();

fetchMock.resetMocks();
});

test('name should be "confetti"', () => {
expect(balloon.name).toBe('confetti');
});

test('name should be the same as the class name', () => {
expect(balloon.name).toBe('confetti');
expect(balloon.name).toBe(Confetti.name.toLowerCase());
});
});
Loading