mirror of
https://github.com/Ujwal223/FocusGram.git
synced 2026-07-08 04:07:51 +02:00
Feature Pack with bug fixes for V2
This commit is contained in:
@@ -5,20 +5,22 @@ import 'package:focusgram/scripts/focus_scripts.dart';
|
||||
|
||||
void main() {
|
||||
group('FocusSettings — Field cleanup', () {
|
||||
test('only ghostMode remains (fullDmGhost and storyGhost removed)',
|
||||
() async {
|
||||
const settings = FocusSettings(ghostMode: true);
|
||||
test(
|
||||
'only ghostMode remains (fullDmGhost and storyGhost removed)',
|
||||
() async {
|
||||
const settings = FocusSettings(ghostMode: true);
|
||||
|
||||
expect(settings.ghostMode, isTrue);
|
||||
expect(settings.noAds, isTrue);
|
||||
expect(settings.noStories, isFalse);
|
||||
expect(settings.noReels, isFalse);
|
||||
expect(settings.noAutoplay, isFalse);
|
||||
expect(settings.noDMs, isFalse);
|
||||
expect(settings.ghostMode, isTrue);
|
||||
expect(settings.noAds, isTrue);
|
||||
expect(settings.noStories, isFalse);
|
||||
expect(settings.noReels, isFalse);
|
||||
expect(settings.noAutoplay, isFalse);
|
||||
expect(settings.noDMs, isFalse);
|
||||
|
||||
// Verify fullDmGhost and storyGhost are NOT fields anymore
|
||||
// (these would be compile errors if they existed)
|
||||
});
|
||||
// Verify fullDmGhost and storyGhost are NOT fields anymore
|
||||
// (these would be compile errors if they existed)
|
||||
},
|
||||
);
|
||||
|
||||
test('default ghostMode is false', () async {
|
||||
const settings = FocusSettings();
|
||||
@@ -43,8 +45,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('does NOT inject ghost scripts when ghostMode is false', () async {
|
||||
final scripts =
|
||||
buildUserScripts(const FocusSettings(ghostMode: false));
|
||||
final scripts = buildUserScripts(const FocusSettings(ghostMode: false));
|
||||
|
||||
// Should have no start scripts (ghostMode is the only start-level script)
|
||||
// unless other features like noAutoplay are also false
|
||||
@@ -62,9 +63,9 @@ void main() {
|
||||
);
|
||||
|
||||
// Should have 1 DOCUMENT_START script combining ghost + autoplay
|
||||
final startScripts =
|
||||
scripts.where((s) =>
|
||||
s.injectionTime == UserScriptInjectionTime.AT_DOCUMENT_START);
|
||||
final startScripts = scripts.where(
|
||||
(s) => s.injectionTime == UserScriptInjectionTime.AT_DOCUMENT_START,
|
||||
);
|
||||
expect(startScripts.length, equals(1));
|
||||
expect(startScripts.first.source, contains('__fgFullDmGhost=true'));
|
||||
expect(startScripts.first.source, contains('document.addEventListener'));
|
||||
|
||||
Reference in New Issue
Block a user