Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecmelt committed Nov 15, 2024
1 parent 9fe318f commit a5fe183
Show file tree
Hide file tree
Showing 2 changed files with 317 additions and 0 deletions.
177 changes: 177 additions & 0 deletions tests/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,183 @@ Object {
}
`;

exports[`recipe-nesting excludes components for Condensed Ley-Line Essence items if they are components of each other 1`] = `
Array [
Object {
"achievement_id": undefined,
"components": Array [
Object {
"id": 24272,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24464,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24326,
"quantity": 1,
"type": "Item",
},
Object {
"id": 91224,
"quantity": 2,
"type": "Item",
},
],
"disciplines": Array [
"Mystic Forge",
],
"id": 91137,
"merchant": undefined,
"min_rating": 400,
"multipleRecipeCount": 3,
"output": 1,
"output_range": undefined,
"prerequisites": Array [
Object {
"id": 1,
"type": "Recipe",
},
],
"quantity": 1,
"type": "Recipe",
"upgrade_id": undefined,
},
Object {
"achievement_id": undefined,
"components": Array [
Object {
"id": 24272,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24534,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24326,
"quantity": 1,
"type": "Item",
},
Object {
"id": 91224,
"quantity": 2,
"type": "Item",
},
],
"disciplines": Array [
"Mystic Forge",
],
"id": 91171,
"merchant": undefined,
"min_rating": 400,
"multipleRecipeCount": 3,
"output": 1,
"output_range": undefined,
"prerequisites": Array [
Object {
"id": 2,
"type": "Recipe",
},
],
"quantity": 1,
"type": "Recipe",
"upgrade_id": undefined,
},
Object {
"achievement_id": undefined,
"components": Array [
Object {
"id": 24272,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24464,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24326,
"quantity": 1,
"type": "Item",
},
Object {
"id": 91224,
"quantity": 2,
"type": "Item",
},
],
"disciplines": Array [
"Mystic Forge",
],
"id": 91222,
"merchant": undefined,
"min_rating": 400,
"multipleRecipeCount": 3,
"output": 1,
"output_range": undefined,
"prerequisites": Array [
Object {
"id": 3,
"type": "Recipe",
},
],
"quantity": 1,
"type": "Recipe",
"upgrade_id": undefined,
},
Object {
"achievement_id": undefined,
"components": Array [
Object {
"id": 24272,
"quantity": 1,
"type": "Item",
},
Object {
"id": 24465,
"quantity": 1,
"type": "Item",
},
Object {
"id": 91137,
"quantity": 1,
"type": "Item",
},
Object {
"id": 91224,
"quantity": 2,
"type": "Item",
},
],
"disciplines": Array [
"Mystic Forge",
],
"id": 91224,
"merchant": undefined,
"min_rating": 400,
"multipleRecipeCount": 3,
"output": 1,
"output_range": undefined,
"prerequisites": Array [
Object {
"id": 4,
"type": "Recipe",
},
],
"quantity": 1,
"type": "Recipe",
"upgrade_id": undefined,
},
]
`;

exports[`recipe-nesting orders the components correctly 1`] = `
Object {
"achievement_id": undefined,
Expand Down
140 changes: 140 additions & 0 deletions tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,144 @@ describe('recipe-nesting', () => {
it('ignores recipes with only guild upgrades', () => {
expect(output.find((x) => x.id === 4567)).toEqual(undefined)
})

it('excludes components for Condensed Ley-Line Essence items if they are components of each other', () => {
const input: Array<API_Recipes_Entry_Next> = [
{
type: 'Recipe',
output_item_id: 91137,
output_item_count: 1,
min_rating: 400,
disciplines: ['Mystic Forge'],
flags: [],
ingredients: [
{
id: 24272,
type: 'Item',
count: 1,
},
{
id: 24464,
type: 'Item',
count: 1,
},
{
id: 24326,
type: 'Item',
count: 1,
},
{
id: 91224,
type: 'Item',
count: 2,
},
],
id: 1,
chat_link: '[&CQIAAAA=]',
multipleRecipeCount: 3,
},
{
type: 'Recipe',
output_item_id: 91171,
output_item_count: 1,
min_rating: 400,
disciplines: ['Mystic Forge'],
flags: [],
ingredients: [
{
id: 24272,
type: 'Item',
count: 1,
},
{
id: 24534,
type: 'Item',
count: 1,
},
{
id: 24326,
type: 'Item',
count: 1,
},
{
id: 91224,
type: 'Item',
count: 2,
},
],
id: 2,
chat_link: '[&CQIAAAA=]',
multipleRecipeCount: 3,
},
{
type: 'Recipe',
output_item_id: 91222,
output_item_count: 1,
min_rating: 400,
disciplines: ['Mystic Forge'],
flags: [],
ingredients: [
{
id: 24272,
type: 'Item',
count: 1,
},
{
id: 24464,
type: 'Item',
count: 1,
},
{
id: 24326,
type: 'Item',
count: 1,
},
{
id: 91224,
type: 'Item',
count: 2,
},
],
id: 3,
chat_link: '[&CQIAAAA=]',
multipleRecipeCount: 3,
},
{
type: 'Recipe',
output_item_id: 91224,
output_item_count: 1,
min_rating: 400,
disciplines: ['Mystic Forge'],
flags: [],
ingredients: [
{
id: 24272,
type: 'Item',
count: 1,
},
{
id: 24465,
type: 'Item',
count: 1,
},
{
id: 91137,
type: 'Item',
count: 1,
},
{
id: 91224,
type: 'Item',
count: 2,
},
],
id: 4,
chat_link: '[&CQIAAAA=]',
multipleRecipeCount: 3,
},
]

const output = nestRecipes(input)
expect(output).toMatchSnapshot()
})
})

0 comments on commit a5fe183

Please sign in to comment.