Skip to content

Commit

Permalink
chore: update breadcrumb test
Browse files Browse the repository at this point in the history
Signed-off-by: Tim deBoer <[email protected]>
  • Loading branch information
deboer-tim committed Oct 17, 2023
1 parent 341948d commit 28d7a36
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/renderer/src/stores/breadcrumb.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
/**********************************************************************
* Copyright (C) 2023 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import type { TinroBreadcrumb } from 'tinro';
import { lastPage, currentPage, history } from './breadcrumb';
import { test, expect } from 'vitest';
import { get } from 'svelte/store';

export function mockBreadcrumb() {
history.set([{ name: 'List', path: '/list' } as TinroBreadcrumb]);
lastPage.set({ name: 'Previous', path: '/last' } as TinroBreadcrumb);
currentPage.set({ name: 'Current', path: '/current' } as TinroBreadcrumb);
}

test('Confirm mock values', async () => {
mockBreadcrumb();

const cur = get(lastPage);
expect(cur.name, 'Current');

const last = get(lastPage);
expect(last.name, 'Previous');

const hist = get(history);
expect(hist[0].name, 'List');
});

0 comments on commit 28d7a36

Please sign in to comment.