Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Guhapriya01 committed Apr 3, 2024
1 parent e16ea5d commit eb81db2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 40 deletions.
10 changes: 5 additions & 5 deletions app/routes/library/details/books.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Route from '@ember/routing/route';
import {action} from '@ember/object';
import { action } from '@ember/object';
export default class LibraryDetailsBooksRoute extends Route {
// @action
// bubbled(){
// console.log('bubbled from book');
// }
// @action
// bubbled(){
// console.log('bubbled from book');
// }
}
2 changes: 1 addition & 1 deletion app/templates/library/details/books/book.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{page-title "Book"}}

<div align="center" class="book">
<div align="center">
<h3>{{this.model.name}}</h3>
<h4><u>DESCRIPTION</u></h4>
<p>Author : {{this.model.author}}</p>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/library/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div align="center">
<h1>Libraries</h1>
{{#each this.model as |lib|}}
<div style="padding:10px">
<div style="padding:10px" class="library">
<LinkTo @route="library.details" @model={{lib.id}}>{{lib.name}}</LinkTo>
</div>
{{/each}}
Expand Down
13 changes: 0 additions & 13 deletions tests/acceptance/book-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'my-app/tests/helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';

module('Acceptance | book', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);

test('visiting /book', async function (assert) {
await visit('/book');
Expand All @@ -14,15 +12,4 @@ module('Acceptance | book', function (hooks) {

assert.strictEqual(currentURL(), '/book');
});

test('mirage testing',async function (assert) {

this.server.createList('library', 3);
console.log(this.server.db);

await visit('/book');

// assert.dom('.book').exists();
assert.ok(true);
})
});
25 changes: 25 additions & 0 deletions tests/acceptance/library-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'my-app/tests/helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';
module('Acceptance | library', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);


test('visiting /library', async function (assert) {
await visit('/library');

assert.strictEqual(currentURL(), '/library');
});

test('mirage testing', async function (assert) {
this.server.createList('library', 3);
console.log(this.server.db);

await visit('/library');

assert.dom('.library').exists({count:3});
assert.ok(true);
});
});
9 changes: 4 additions & 5 deletions tests/integration/components/nav-bar-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test ,skip} from 'qunit';
import { module, test, skip } from 'qunit';
import { setupRenderingTest } from 'my-app/tests/helpers';
import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
Expand All @@ -24,14 +24,13 @@ module('Integration | Component | nav-bar', function (hooks) {
assert.dom().hasText('template block text');
});

test('user interaction ', async function(assert) {
test('user interaction ', async function (assert) {
await render(hbs`<NavBar/>`);

// assert.dom('#numLibraryReq').hasAnyText('0');

await click('.buttonMode');
// assert.dom('.buttonMode').hasText('dark');
assert.dom('.buttonMode').hasText('light');

})
});
});
16 changes: 8 additions & 8 deletions tests/unit/controllers/library/details/read-book-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupTest } from 'my-app/tests/helpers';
import {set} from '@ember/object';
import { set } from '@ember/object';

module('Unit | Controller | library/details/read-book', function (hooks) {
setupTest(hooks);
Expand All @@ -12,16 +12,16 @@ module('Unit | Controller | library/details/read-book', function (hooks) {
});

test('checking getbook action', function (assert) {
let controller = this.owner.lookup("controller:library/details/read-book");
let router = this.owner.lookup("service:router");
let controller = this.owner.lookup('controller:library/details/read-book');
let router = this.owner.lookup('service:router');

set(controller,'name','priya');
set(controller,'email','priya@gmail.com');
set(controller,'router',router);
set(controller, 'name', 'priya');
set(controller, 'email', 'priya@gmail.com');
set(controller, 'router', router);

assert.equal(controller.name,'priya','name equal');
assert.equal(controller.name, 'priya', 'name equal');
// controller.getBook();
// controller.send('getBooK');
// console.log(controller);
})
});
});
13 changes: 6 additions & 7 deletions tests/unit/models/book-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { module, test } from 'qunit';
import { setupTest } from 'my-app/tests/helpers';
import { get } from '@ember/object';


module('Unit | Model | book', function (hooks) {
setupTest(hooks);

Expand All @@ -13,13 +12,13 @@ module('Unit | Model | book', function (hooks) {
assert.ok(model);
});

test('testing relationships', function(assert){
let Book = this.owner.lookup("service:store").modelFor("book");
let library =get(Book,'relationshipsByName').get('library');
test('testing relationships', function (assert) {
let Book = this.owner.lookup('service:store').modelFor('book');
let library = Book.relationshipsByName.get('library');

// console.log(Book);
// console.log(get(Book,'relationshipsByName'));

assert.equal(library.key,'library','has relationship library')
})
assert.equal(library.key, 'library', 'has relationship library');
});
});

0 comments on commit eb81db2

Please sign in to comment.