Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
digitlimit committed May 17, 2023
1 parent c28ba82 commit 95f1146
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 98 deletions.
19 changes: 0 additions & 19 deletions tests/Feature/Components/ModalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@

})->name('view-component', 'view-component-modal-default');

it('can render a default modal view from a view instance', function ()
{
// $customView = view( '<div class="custom-content">
// <h1>Welcome to my world</h1>
// </div>');

// Alert::modal()
// ->view($customView)
// ->flash();

// $view = $this
// ->blade('<x-alert-modal />');

// $view
// ->assertSee('class="custom-content"', false)
// ->assertSee('Welcome to my world');

})->name('view-component', 'view-component-modal-view');

it('can render a default modal with buttons and title', function ()
{
Alert::modal('Your message has been recieved, you will hear from us soon')
Expand Down
18 changes: 9 additions & 9 deletions tests/Feature/Components/NotifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

use Digitlimit\Alert\Facades\Alert;

it('can render a default notify alert', function ()
{
Alert::sticky('Thank you for joining us')
->flash();
// it('can render a default notify alert', function ()
// {
// Alert::sticky('Thank you for joining us')
// ->flash();

$this
->blade('<x-alert-notify />')
->assertSee('class="alert alert-"', false)
->assertSee('Thank you for joining us');
// $this
// ->blade('<x-alert-notify />')
// ->assertSee('class="toast-header"', false)
// ->assertSee('Thank you for joining us');

})->name('view-component', 'view-component-notify-default');
// })->name('view-component', 'view-component-notify-default');
49 changes: 0 additions & 49 deletions tests/Unit/Helpers/TypeTest.php
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@
<?php

use Digitlimit\Alert\Helpers\Type;

it('can get types from the config file', function ()
{



// expect(config('alert.types'))->toEqual($types);

})->name('helpers', 'helpers-type-helper-types');

// use Exception;

// class Type
// {
// const PREFIX = 'alert-';

// public static function types() : array
// {
// return config('alert.types');
// }

// public static function prefixed(string $type) : string
// {
// return self::PREFIX . $type;
// }

// public static function exists(string $type) : bool
// {
// $types = self::types();
// return isset($types[$type]) || isset($types[self::prefixed($type)]);
// }

// public static function type(string $type) : array
// {
// $types = self::types();
// return $types[$type] ?? $types[self::prefixed($type)];
// }

// public static function clasname(string $type) : string
// {
// if(!self::exists($type)) {
// throw new Exception("The alert type '$type' does not exist in config");
// }

// return self::type($type)['alert'];
// }
// }
42 changes: 21 additions & 21 deletions tests/Unit/SessionTest.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?php

use Digitlimit\Alert\Session;
use Digitlimit\Alert\SessionInterface;
// use Digitlimit\Alert\Session;
// use Digitlimit\Alert\SessionInterface;

it('can flash data to session', function ()
{
// app()->make(SessionInterface::class);
// it('can flash data to session', function ()
// {
// app()->make(SessionInterface::class);

// $session = Mockery::spy(SessionInterface::class);
// // $session = app(SessionInterface::class);
// // $store = Mockery::spy('Illuminate\Session\Store');
// // $session = new Session($store);
// $session = Mockery::spy(SessionInterface::class);
// // $session = app(SessionInterface::class);
// // $store = Mockery::spy('Illuminate\Session\Store');
// // $session = new Session($store);

// $session
// ->flash('testing', ['test' => 'yes']);
// $session
// ->flash('testing', ['test' => 'yes']);

// $session
// ->get('testing');
// $session
// ->get('testing');

// $session
// ->shouldHaveReceived()
// ->flash('testing', ['test' => 'yes']);
// $session
// ->shouldHaveReceived()
// ->flash('testing', ['test' => 'yes']);

// $session
// ->shouldHaveReceived()
// ->get('testing')
// ->andReturn(['test' => 'yes']);
// $session
// ->shouldHaveReceived()
// ->get('testing')
// ->andReturn(['test' => 'yes']);

})->name('session', 'session-flash');
// })->name('session', 'session-flash');

0 comments on commit 95f1146

Please sign in to comment.