Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yPhil
Pétrolette
Commits
0c14d0ef
Commit
0c14d0ef
authored
Mar 11, 2022
by
yPhil
Browse files
Leave the dialog open
parent
630ccf00
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
public/js/PTL.dialog.js
View file @
0c14d0ef
This diff is collapsed.
Click to expand it.
test/index.test.js
View file @
0c14d0ef
const
should
=
require
(
'
should
'
),
fs
=
require
(
'
fs
'
),
pjson
=
require
(
'
../package.json
'
),
fetch
=
require
(
'
node-fetch
'
);
fs
=
require
(
'
fs
'
),
pjson
=
require
(
'
../package.json
'
),
fetch
=
require
(
'
node-fetch
'
);
const
PORT
=
pjson
.
HTTP_PORT
;
describe
(
'
Pétrolette
'
,
function
()
{
it
(
'
Favicon cache dir exists
'
,
function
(
done
)
{
fs
.
access
(
pjson
.
FAVICONS_CACHE_DIR
,
function
(
err
)
{
if
(
err
)
return
done
(
err
);
done
();
});
it
(
'
Favicon cache dir exists
'
,
function
(
done
)
{
fs
.
access
(
pjson
.
FAVICONS_CACHE_DIR
,
function
(
err
)
{
if
(
err
)
return
done
(
err
);
return
done
();
});
});
it
(
'
Favicon cache dir is writeable
'
,
function
(
done
)
{
fs
.
access
(
pjson
.
FAVICONS_CACHE_DIR
,
fs
.
constants
.
W_OK
,
function
(
err
)
{
if
(
err
)
return
done
(
err
);
done
();
});
it
(
'
Favicon cache dir is writeable
'
,
function
(
done
)
{
fs
.
access
(
pjson
.
FAVICONS_CACHE_DIR
,
fs
.
constants
.
W_OK
,
function
(
err
)
{
if
(
err
)
return
done
(
err
);
return
done
();
});
});
it
(
'
Pétrolette server is running
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
)
.
then
(
res
=>
{
res
.
status
.
should
.
eql
(
200
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette server is running
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/favicon/?url=https://yphil.bitbucket.io/feed.xml
'
)
.
then
(
res
=>
{
res
.
status
.
should
.
eql
(
200
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette server is running
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
)
.
then
(
res
=>
{
res
.
status
.
should
.
eql
(
200
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning a favicon URL hash
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/favicon/?url=https://yphil.bitbucket.io/feed.xml
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
should
.
eql
(
'
a210177714b9fd9e35bfd7241eb32214
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning a favicon URL hash
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/favicon/?url=https://yphil.bitbucket.io/feed.xml
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
should
.
eql
(
'
a210177714b9fd9e35bfd7241eb32214
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning a feed URL
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/discover/?url=https://yphil.bitbucket.io/
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
{
res
[
0
].
should
.
eql
(
'
https://yphil.bitbucket.io/rss/feedone.xml
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning a feed URL
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/discover/?url=https://yphil.bitbucket.io/
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
{
res
[
0
].
should
.
eql
(
'
https://yphil.bitbucket.io/rss/feedone.xml
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning several feed URLs
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/discover/?url=https://yphil.bitbucket.io/
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
{
res
.
length
.
should
.
eql
(
2
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning several feed URLs
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/discover/?url=https://yphil.bitbucket.io/
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
{
res
.
length
.
should
.
eql
(
4
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning an actual feed
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/feed/?url=https://yphil.bitbucket.io/feed.xml
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
substring
(
2
,
11
).
should
.
eql
(
'
feedItems
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is returning an actual feed
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/feed/?url=https://yphil.bitbucket.io/feed.xml
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
substring
(
2
,
11
).
should
.
eql
(
'
feedItems
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is serving pseudo-static files
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/robots.txt
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
substring
(
0
,
10
).
should
.
eql
(
'
User-agent
'
);
}).
catch
(
done
);
done
();
});
it
(
'
Pétrolette is serving pseudo-static files
'
,
function
(
done
)
{
fetch
(
'
http://localhost:
'
+
PORT
+
'
/robots.txt
'
)
.
then
(
res
=>
res
.
text
())
.
then
(
text
=>
{
text
.
substring
(
0
,
10
).
should
.
eql
(
'
User-agent
'
);
}).
catch
(
done
);
done
();
});
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment