Skip to content

Commit

Permalink
move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanderp committed Nov 20, 2023
1 parent 17a69d7 commit 2aac898
Show file tree
Hide file tree
Showing 46 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"docs": "typedoc --out docs src/index.ts",
"lint": "npm-run-all -c -s tsc eslint",
"tsc": "tsc --noEmit",
"eslint": "eslint --ext ts,js src/ tests/ integration/",
"eslint": "eslint --ext ts,js src/ tests/",
"prepublish": "npm run build",
"test": "jest --testPathIgnorePatterns=\"/integration/\"",
"test": "jest --testPathIgnorePatterns=\"integration/\"",
"test:all": "jest --runInBand",
"coverage": "npm run test -- --coverage",
"coverage:all": "jest --coverage",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as dotenv from 'dotenv';
import { getToken } from '../src';
import { getToken } from '../../src';

dotenv.config();
declare let process : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { requestItem } from '../src';
import { requestItem } from '../../src';

describe('reading from wikidata', () => {
it('should retrieve a item when requested', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as dotenv from 'dotenv';
import {
Alias,
Description, Item, Label, Statement, getToken, upload
} from '../src';
} from '../../src';
import {
exampleCommonsMediaSnak,
exampleExternalIdSnak,
Expand All @@ -21,7 +21,7 @@ import {
exampleUrlSnak,
exampleWikibaseItemSnak,
exampleWikibasePropertySnak
} from '../tests/testUtils/examples/snaks';
} from '../unit/testUtils/examples/snaks';

dotenv.config();
declare let process : {
Expand Down
2 changes: 1 addition & 1 deletion tests/Alias.spec.ts → tests/unit/Alias.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LabelAndDescription } from '@wmde/wikibase-datamodel-types';
import { Alias } from '../src';
import { Alias } from '../../src';

const aliasJson = {
language: 'en',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LabelAndDescription } from '@wmde/wikibase-datamodel-types';
import { Description } from '../src';
import { Description } from '../../src';

const descriptionJson = {
language: 'en',
Expand Down
2 changes: 1 addition & 1 deletion tests/Item.spec.ts → tests/unit/Item.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Description,
Item, Label, SiteLink, Statement, WikibaseItemSnak,
URLSnak
} from '../src';
} from '../../src';

const testFiles = fs.readdirSync(path.resolve(__dirname, './data/'));

Expand Down
2 changes: 1 addition & 1 deletion tests/Label.spec.ts → tests/unit/Label.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LabelAndDescription } from '@wmde/wikibase-datamodel-types';
import { Label } from '../src';
import { Label } from '../../src';

const labelJson = {
language: 'en',
Expand Down
6 changes: 3 additions & 3 deletions tests/References.spec.ts → tests/unit/References.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Reference as wikidataReference } from '@wmde/wikibase-datamodel-types';
import { Reference } from '../src';
import snakGenerator from '../src/utils/snakGenerator';
import URLSnak from '../src/snaks/URLSnak';
import { Reference } from '../../src';
import snakGenerator from '../../src/utils/snakGenerator';
import URLSnak from '../../src/snaks/URLSnak';

const referenceJson: wikidataReference = {
hash: 'e43b1cc9b71d1713d4d6cb76e2abd0b5c36c2a27',
Expand Down
2 changes: 1 addition & 1 deletion tests/SiteLink.spec.ts → tests/unit/SiteLink.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SiteLink } from '../src';
import { SiteLink } from '../../src';

const siteLinkWithUrl = {
site: 'zuwiki',
Expand Down
2 changes: 1 addition & 1 deletion tests/Snak.spec.ts → tests/unit/Snak.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// imported WikiBaseItemSnak because Snak is abstract
import { WikibaseItemSnak } from '../src';
import { WikibaseItemSnak } from '../../src';

describe('Snak', () => {
describe('constructor', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommonsMediaSnak } from '../../src';
import { CommonsMediaSnak } from '../../../src';

const commonsSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExternalIdentifierSnak } from '../../src';
import { ExternalIdentifierSnak } from '../../../src';

const ExternalSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GeoShapeSnak } from '../../src';
import { GeoShapeSnak } from '../../../src';

const geoShapeSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlobeCoordinateSnak } from '../../src';
import { GlobeCoordinateSnak } from '../../../src';

const globeCoordinateSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MathSnak } from '../../src';
import { MathSnak } from '../../../src';

const mathSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MonolingualTextSnak } from '../../src';
import { MonolingualTextSnak } from '../../../src';

const monolingualTextSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MusicalNotationSnak } from '../../src';
import { MusicalNotationSnak } from '../../../src';

const musicalNotationSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QuantitySnak } from '../../src';
import { QuantitySnak } from '../../../src';

const quantitySnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StringSnak } from '../../src';
import { StringSnak } from '../../../src';

const stringSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TabularDataSnak } from '../../src';
import { TabularDataSnak } from '../../../src';

const tabularDataSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable sonarjs/no-duplicate-string */

import { TimeSnak } from '../../src';
import { TimeSnak } from '../../../src';

const timeSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URLSnak } from '../../src';
import { URLSnak } from '../../../src';

const urlSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WikibaseItemSnak } from '../../src';
import { WikibaseItemSnak } from '../../../src';

const wikibaseItemSnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WikibasePropertySnak } from '../../src';
import { WikibasePropertySnak } from '../../../src';

const wikibasePropertySnak = {
snaktype: 'value' as const,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import snakGenerator from '../../../src/utils/snakGenerator';
import snakGenerator from '../../../../src/utils/snakGenerator';

const unknownSnak = {
snaktype: 'value' as const,
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement.spec.ts → tests/unit/Statement.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Statement as WikidataStatement } from '@wmde/wikibase-datamodel-types';
import {
Statement, StringSnak, URLSnak, WikibaseItemSnak
} from '../src';
} from '../../src';

const statementJson: WikidataStatement = {
mainsnak: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
URLSnak,
WikibaseItemSnak,
WikibasePropertySnak
} from '../../../src';
} from '../../../../src';

// CommonsMediaSnak
const commonsMediaJson: WikidataCommonsMediaSnak = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from 'axios';
import getToken, { loginUrl } from '../../../src/utils/api/token';
import getToken, { loginUrl } from '../../../../src/utils/api/token';

jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import fs from 'fs';
import path from 'path';
import axios from 'axios';

import { baseURL } from '../../../src/utils/api/request';
import { requestItem } from '../../../src';
import { baseURL } from '../../../../src/utils/api/request';
import { requestItem } from '../../../../src';

jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from 'axios';
import qs from 'qs';
import upload, { generateURL, validateAuthentication } from '../../../src/utils/api/upload';
import { Item } from '../../../src';
import { Token } from '../../../src/utils/api/token';
import upload, { generateURL, validateAuthentication } from '../../../../src/utils/api/upload';
import { Item } from '../../../../src';
import { Token } from '../../../../src/utils/api/token';

jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import arrayEqual, { arrayEqualWith } from '../../src/utils/arrayEqual';
import arrayEqual, { arrayEqualWith } from '../../../src/utils/arrayEqual';

const arrayOfABC = ['a', 'b', 'c'];
const arrayOfADB = ['a', 'd', 'b'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Alias } from '../../../src';
import aliasDiff from '../../../src/utils/diff/aliasDiff';
import { Changes } from '../../../src/utils/diff/Changes';
import { Alias } from '../../../../src';
import aliasDiff from '../../../../src/utils/diff/aliasDiff';
import { Changes } from '../../../../src/utils/diff/Changes';

describe('alias diff', () => {
it('should diff aliases right', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Description } from '../../../src';
import { Changes } from '../../../src/utils/diff/Changes';
import descriptionDiff from '../../../src/utils/diff/descriptionDiff';
import { Description } from '../../../../src';
import { Changes } from '../../../../src/utils/diff/Changes';
import descriptionDiff from '../../../../src/utils/diff/descriptionDiff';

describe('description diff', () => {
it('should diff descriptions right', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Label } from '../../../src';
import { Changes } from '../../../src/utils/diff/Changes';
import labelDiff from '../../../src/utils/diff/labelDiff';
import { Label } from '../../../../src';
import { Changes } from '../../../../src/utils/diff/Changes';
import labelDiff from '../../../../src/utils/diff/labelDiff';

describe('label diff', () => {
it('should diff labels right', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SiteLink } from '../../../src';
import { Changes } from '../../../src/utils/diff/Changes';
import siteLinkDiff from '../../../src/utils/diff/siteLinkDiff';
import { SiteLink } from '../../../../src';
import { Changes } from '../../../../src/utils/diff/Changes';
import siteLinkDiff from '../../../../src/utils/diff/siteLinkDiff';

describe('siteLink diff', () => {
it('should diff Sitelinks right', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WikibaseItemSnak from '../../../src/snaks/WikibaseItemSnak';
import Statement from '../../../src/Statement';
import statementDiff from '../../../src/utils/diff/statementsDiff';
import { Changes } from '../../../src/utils/diff/Changes';
import WikibaseItemSnak from '../../../../src/snaks/WikibaseItemSnak';
import Statement from '../../../../src/Statement';
import statementDiff from '../../../../src/utils/diff/statementsDiff';
import { Changes } from '../../../../src/utils/diff/Changes';

describe('statement diff', () => {
it('should diff statements right', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isStatementChange } from '../../../src/index';
import { StatementChange } from '../../../src/utils/diff/statementsDiff';
import { LabelChange } from '../../../src/utils/diff/labelDiff';
import { isStatementChange } from '../../../../src/index';
import { StatementChange } from '../../../../src/utils/diff/statementsDiff';
import { LabelChange } from '../../../../src/utils/diff/labelDiff';

const statementChange: StatementChange = {
type: 'statement',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
isURLSnak,
isWikibaseItemSnak,
isWikibasePropertySnak
} from '../../../src/utils/guards/snak';
} from '../../../../src/utils/guards/snak';

describe(
'isCommonsMediaSnak',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isPString, isQString } from '../../../src';
import { isPString, isQString } from '../../../../src';

const QStrings: [string, boolean][] = [
['Q1', true],
Expand Down

0 comments on commit 2aac898

Please sign in to comment.