Skip to content

Commit

Permalink
Test windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed Jul 1, 2024
1 parent 84fc40f commit ac43241
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t/conf/whelk_openapi.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
api_openapi => {
path => '/',

# format => 'yaml',
format => 'yaml',
info => {
title => 'OpenApi/Swagger integration for Whelk',
description =>
Expand Down
13 changes: 11 additions & 2 deletions t/openapi.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use YAML::PP;

use lib 't/lib';

plan skip_all => 'nevermind';

my $app = Whelk->new(mode => 'openapi');
my $t = Kelp::Test->new(app => $app);

Expand All @@ -21,8 +23,15 @@ my $content = do {
};

$t->request(GET '/')
->code_is(200)
->yaml_cmp($content);
->code_is(200);
# ->yaml_cmp($content);

my $data = $t->res->content;
$data =~ s/\r/CR/g;
$data =~ s/\n/LF/g;
diag $data;

pass;

done_testing;

Expand Down
36 changes: 36 additions & 0 deletions t/windows.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use Kelp::Base -strict;
use Test::More;
use Test::Deep;
use YAML::PP;
use Path::Tiny;

my $yaml = YAML::PP->new;

my $content = do {
local $/;
my $data = <DATA>;
$yaml->load_string($data);
};

my $config_data = path(__FILE__)->parent->child('conf')->child('whelk_openapi.pl')->slurp_utf8;
my $config = eval $config_data;


my $encoded = $yaml->dump_string({info => {description => $config->{api_openapi}{info}{description}}});
my $content2 = $yaml->load_string($encoded);

$encoded =~ s/\r/CR/g;
$encoded =~ s/\n/LF/g;
diag $encoded;

is_deeply $content, $content2, 'no bug ok';

done_testing;

__DATA__
info:
description: |-
An API (Application Programming Interface) is a set of protocols, tools, and definitions that allows different software applications to communicate with each other. APIs define the methods and data formats that applications can use to request and exchange information, enabling seamless integration between diverse systems. By providing a standardized way for applications to interact, APIs simplify the development process, allowing developers to leverage existing functionalities without having to build them from scratch. This can significantly enhance the efficiency and scalability of software projects.
APIs can be designed for various purposes, including web services, operating systems, libraries, and databases. Web APIs, for example, enable web applications to communicate with servers over the internet, often using HTTP/HTTPS protocols. They typically follow REST (Representational State Transfer) or SOAP (Simple Object Access Protocol) architectures, each with its own conventions and best practices. RESTful APIs use standard HTTP methods like GET, POST, PUT, and DELETE, and usually return data in JSON or XML formats. By providing a clear and consistent interface, APIs empower developers to create robust, flexible, and interoperable applications that can easily integrate with other services and platforms.

0 comments on commit ac43241

Please sign in to comment.